[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439165#comment-16439165
 ] 

ASF GitHub Bot commented on SCB-456:


liubao68 closed pull request #632: [SCB-456]Provider a way to input 
configuration from a Map
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/632
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
index fbef8a9a1..076caaf67 100644
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
@@ -21,6 +21,7 @@
 import static 
org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_KEY_SPLITER;
 import static 
org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_SERVICECOMB_PREFIX;
 
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -52,9 +53,19 @@
 
   private static final String MICROSERVICE_CONFIG_LOADER_KEY = 
"cse-microservice-config-loader";
 
+  private static Map localConfig = new HashMap<>();
+
   private ConfigUtil() {
   }
 
+  public static void setConfigs(Map config) {
+localConfig = config;
+  }
+
+  public static void addConfig(String key, Object value) {
+localConfig.put(key, value);
+  }
+
   public static Object getProperty(String key) {
 Object config = DynamicPropertyFactory.getBackingConfigurationSource();
 return getProperty(config, key);
@@ -83,6 +94,11 @@ public static MicroserviceConfigLoader 
getMicroserviceConfigLoader(Configuration
   public static ConcurrentCompositeConfiguration createLocalConfig() {
 MicroserviceConfigLoader loader = new MicroserviceConfigLoader();
 loader.loadAndSort();
+if (localConfig.size() > 0) {
+  ConfigModel model = new ConfigModel();
+  model.setConfig(localConfig);
+  loader.getConfigModels().add(model);
+}
 
 LOGGER.info("create local config:");
 for (ConfigModel configModel : loader.getConfigModels()) {
@@ -94,6 +110,8 @@ public static ConcurrentCompositeConfiguration 
createLocalConfig() {
 return config;
   }
 
+
+
   public static ConcurrentCompositeConfiguration 
createLocalConfig(List configModelList) {
 ConcurrentCompositeConfiguration config = new 
ConcurrentCompositeConfiguration();
 
diff --git 
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
 
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
index 27fe3586d..a61555a0e 100644
--- 
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
+++ 
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
@@ -27,7 +27,9 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.HashMap;
 
+import com.netflix.config.*;
 import org.apache.commons.configuration.AbstractConfiguration;
 import org.apache.commons.configuration.Configuration;
 import org.apache.servicecomb.config.archaius.sources.ConfigModel;
@@ -40,11 +42,6 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import com.netflix.config.ConcurrentCompositeConfiguration;
-import com.netflix.config.DynamicConfiguration;
-import com.netflix.config.DynamicPropertyFactory;
-import com.netflix.config.DynamicWatchedConfiguration;
-
 import mockit.Deencapsulation;
 import mockit.Expectations;
 import mockit.Mocked;
@@ -80,6 +77,20 @@ public static void tearDown() throws Exception {
 ArchaiusUtils.resetConfig();
   }
 
+  @Test
+  public void testAddConfig() {
+Map config = new HashMap();
+config.put("service_description.name", "service_name_test");
+ConfigUtil.setConfigs(config);
+ConfigUtil.addConfig("service_description.version", "1.0.2");
+ConfigUtil.addConfig("cse.test.enabled", true);
+ConfigUtil.addConfig("cse.test.num", 10);
+AbstractConfiguration configuration = ConfigUtil.createDynamicConfig();
+Assert.assertEquals(configuration.getString("service_description.name"), 
"service_name_test");
+Assert.assertEquals(configuration.getBoolean("cse.test.enabled"), true);
+Assert.assertEquals(configuration.getInt("cse.test.num"), 10);
+  }
+
   @Test
   public void testCreateConfigFromConfigCenterNoUrl(@Mocked Configuration 
localConfiguration) {
 AbstractConfiguration configFromConfigCenter 

[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16438269#comment-16438269
 ] 

ASF GitHub Bot commented on SCB-456:


coveralls commented on issue #632: [SCB-456]Provider a way to input 
configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#issuecomment-378196411
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/16514680/badge)](https://coveralls.io/builds/16514680)
   
   Coverage increased (+0.006%) to 87.48% when pulling 
**dc86c22bd1c72a2f72b890171ad075bd1eecbde3 on jasononion:master** into 
**dfb7d3577a789305ce3c053e323d0ec54a825d55 on apache:master**.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16438227#comment-16438227
 ] 

ASF GitHub Bot commented on SCB-456:


jasononion commented on a change in pull request #632: [SCB-456]Provider a way 
to input configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#discussion_r181541336
 
 

 ##
 File path: 
foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
 ##
 @@ -52,9 +52,15 @@
 
   private static final String MICROSERVICE_CONFIG_LOADER_KEY = 
"cse-microservice-config-loader";
 
+  private static ConfigModel model = new ConfigModel();
+
   private ConfigUtil() {
   }
 
+  public static void setConfigs(Map config) {
 
 Review comment:
   you mean we provide both addConfig and setConfigs? or just replace 
setConfigs ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16433635#comment-16433635
 ] 

ASF GitHub Bot commented on SCB-456:


WillemJiang commented on issue #632: [SCB-456]Provider a way to input 
configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#issuecomment-380392745
 
 
   @jasononion  Could you take a look at the new comments from Liubao?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16430001#comment-16430001
 ] 

ASF GitHub Bot commented on SCB-456:


liubao68 commented on a change in pull request #632: [SCB-456]Provider a way to 
input configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#discussion_r179982646
 
 

 ##
 File path: 
foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
 ##
 @@ -52,9 +52,15 @@
 
   private static final String MICROSERVICE_CONFIG_LOADER_KEY = 
"cse-microservice-config-loader";
 
+  private static ConfigModel model = new ConfigModel();
+
   private ConfigUtil() {
   }
 
+  public static void setConfigs(Map config) {
 
 Review comment:
   I think if we can provide a more convenient method to add configs . e.g. 
   public static void addConfig(String k, Object v)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=1643#comment-1643
 ] 

ASF GitHub Bot commented on SCB-456:


liubao68 commented on a change in pull request #632: [SCB-456]Provider a way to 
input configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#discussion_r179982498
 
 

 ##
 File path: 
foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
 ##
 @@ -80,6 +81,16 @@ public static void tearDown() throws Exception {
 ArchaiusUtils.resetConfig();
   }
 
+  @Test
+  public void testAddConfig() {
+Map config = new HashMap();
+config.put("APPLICATION_ID", "app");
+ConfigUtil.setConfigs(config);
+ConcurrentCompositeConfiguration configuration = 
ConfigUtil.createLocalConfig();
+Assert.assertEquals(configuration.getString("APPLICATION_ID"), "app");
 
 Review comment:
   Can you provide a test case for dynamic property change is work? (callback)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16426574#comment-16426574
 ] 

ASF GitHub Bot commented on SCB-456:


WillemJiang commented on issue #632: [SCB-456]Provider a way to input 
configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#issuecomment-378845252
 
 
   @wujimin  I don't like the way of System.setProperties(Properties props), it 
could cause some side effect there are some starter building the microservice 
metadata in the same JVM. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16425277#comment-16425277
 ] 

ASF GitHub Bot commented on SCB-456:


jasononion commented on issue #632: [SCB-456]Provider a way to input 
configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#issuecomment-378547947
 
 
   @wujimin Yes, these two method both can input configurations, but this PR 
can provider a new choice


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16425232#comment-16425232
 ] 

ASF GitHub Bot commented on SCB-456:


jasononion commented on a change in pull request #632: [SCB-456]Provider a way 
to input configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#discussion_r179075398
 
 

 ##
 File path: 
foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
 ##
 @@ -52,9 +52,15 @@
 
   private static final String MICROSERVICE_CONFIG_LOADER_KEY = 
"cse-microservice-config-loader";
 
+  private static ConfigModel model = new ConfigModel();
+
   private ConfigUtil() {
   }
 
+  public static void addConfigs(Map config) {
 
 Review comment:
   Already modified


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16425209#comment-16425209
 ] 

ASF GitHub Bot commented on SCB-456:


wujimin commented on issue #632: [SCB-456]Provider a way to input configuration 
from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#issuecomment-378529365
 
 
   System.setProperties(Properties props) can take the same affect?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16425192#comment-16425192
 ] 

ASF GitHub Bot commented on SCB-456:


jasononion commented on issue #632: [SCB-456]Provider a way to input 
configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#issuecomment-378525380
 
 
   @wujimin This PR is for inputing configuration from Map instead of 
microservice.yaml


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-03 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16424820#comment-16424820
 ] 

ASF GitHub Bot commented on SCB-456:


wujimin commented on issue #632: [SCB-456]Provider a way to input configuration 
from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#issuecomment-378444929
 
 
   what's requirements of this PR?
   just provide a chance for developers to init some configuration before 
servicecomb init?
   
   if we want to do this, just let developers invoke 
System.setProperties(Properties props), it's enough?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-03 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16424036#comment-16424036
 ] 

ASF GitHub Bot commented on SCB-456:


WillemJiang commented on a change in pull request #632: [SCB-456]Provider a way 
to input configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#discussion_r178827369
 
 

 ##
 File path: 
foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
 ##
 @@ -52,9 +52,15 @@
 
   private static final String MICROSERVICE_CONFIG_LOADER_KEY = 
"cse-microservice-config-loader";
 
+  private static ConfigModel model = new ConfigModel();
+
   private ConfigUtil() {
   }
 
+  public static void addConfigs(Map config) {
 
 Review comment:
   As this method is just set the internal cofigModel,  it's better to use 
setConfigs instead of addConfigs.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-03 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16423796#comment-16423796
 ] 

ASF GitHub Bot commented on SCB-456:


coveralls commented on issue #632: [SCB-456]Provider a way to input 
configuration from a Map
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/632#issuecomment-378196411
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/16311971/badge)](https://coveralls.io/builds/16311971)
   
   Coverage increased (+0.05%) to 87.601% when pulling 
**c0bc6264199d03d1dcda2bc08b86d137e0fd49a1 on jasononion:master** into 
**538bebfd242fa0633f19aabfb7a71e6d847d577c on apache:master**.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-03 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16423725#comment-16423725
 ] 

ASF GitHub Bot commented on SCB-456:


liubao68 closed pull request #632: [SCB-456]Provider a way to input 
configuration from a Map
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/632
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
index fbef8a9a1..7e9917624 100644
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
@@ -52,9 +52,15 @@
 
   private static final String MICROSERVICE_CONFIG_LOADER_KEY = 
"cse-microservice-config-loader";
 
+  private static ConfigModel model = new ConfigModel();
+
   private ConfigUtil() {
   }
 
+  public static void addConfigs(Map config) {
+model.setConfig(config);
+  }
+
   public static Object getProperty(String key) {
 Object config = DynamicPropertyFactory.getBackingConfigurationSource();
 return getProperty(config, key);
@@ -83,6 +89,9 @@ public static MicroserviceConfigLoader 
getMicroserviceConfigLoader(Configuration
   public static ConcurrentCompositeConfiguration createLocalConfig() {
 MicroserviceConfigLoader loader = new MicroserviceConfigLoader();
 loader.loadAndSort();
+if(model.getConfig() != null) {
+  loader.getConfigModels().add(model);
+}
 
 LOGGER.info("create local config:");
 for (ConfigModel configModel : loader.getConfigModels()) {
@@ -94,6 +103,8 @@ public static ConcurrentCompositeConfiguration 
createLocalConfig() {
 return config;
   }
 
+
+
   public static ConcurrentCompositeConfiguration 
createLocalConfig(List configModelList) {
 ConcurrentCompositeConfiguration config = new 
ConcurrentCompositeConfiguration();
 
diff --git 
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
 
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
index 27fe3586d..08846e1a5 100644
--- 
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
+++ 
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
@@ -27,6 +27,7 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.HashMap;
 
 import org.apache.commons.configuration.AbstractConfiguration;
 import org.apache.commons.configuration.Configuration;
@@ -80,6 +81,16 @@ public static void tearDown() throws Exception {
 ArchaiusUtils.resetConfig();
   }
 
+  @Test
+  public void testAddConfig() {
+Map config = new HashMap();
+config.put("APPLICATION_ID", "app");
+ConfigUtil.addConfigs(config);
+ConcurrentCompositeConfiguration configuration = 
ConfigUtil.createLocalConfig();
+Assert.assertEquals(configuration.getString("APPLICATION_ID"), "app");
+
+  }
+
   @Test
   public void testCreateConfigFromConfigCenterNoUrl(@Mocked Configuration 
localConfiguration) {
 AbstractConfiguration configFromConfigCenter = 
ConfigUtil.createConfigFromConfigCenter(localConfiguration);


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-456) Provider a way to input configuration from a Map, instead of micreservice.yaml

2018-04-03 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16423726#comment-16423726
 ] 

ASF GitHub Bot commented on SCB-456:


jasononion opened a new pull request #632: [SCB-456]Provider a way to input 
configuration from a Map
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/632
 
 
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Provider a way to input configuration from a Map, instead of  
> micreservice.yaml
> ---
>
> Key: SCB-456
> URL: https://issues.apache.org/jira/browse/SCB-456
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: Minzhi Yan
>Assignee: Minzhi Yan
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)