[incubator-dubbo] branch dev-metadata updated: temporarily close checkstyle on importing orders

2018-11-27 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/dev-metadata by this push:
 new 0fb3657  temporarily close checkstyle on importing orders
0fb3657 is described below

commit 0fb3657c1445fe6d9ec226375421ef837d81e753
Author: ken.lj 
AuthorDate: Wed Nov 28 10:32:26 2018 +0800

temporarily close checkstyle on importing orders
---
 codestyle/checkstyle.xml | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/codestyle/checkstyle.xml b/codestyle/checkstyle.xml
index 621a9e3..f721d51 100644
--- a/codestyle/checkstyle.xml
+++ b/codestyle/checkstyle.xml
@@ -21,10 +21,10 @@
 
 
 
-
-
-
-
-
+
+
+
+
+
 
 
\ No newline at end of file



[incubator-dubbo] 06/06: save one zookeeper implementation as default

2018-11-27 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git

commit d9e0b6464bd86aa3b916f894d53865f78671012b
Author: ken.lj 
AuthorDate: Tue Nov 27 19:07:42 2018 +0800

save one zookeeper implementation as default
---
 .../dubbo-configcenter-archaius/pom.xml|  53 
 .../zookeeper/ArchaiusDynamicConfiguration.java| 163 -
 .../sources/ZooKeeperConfigurationSource.java  | 268 -
 apache.dubbo.configcenter.DynamicConfiguration |   1 -
 .../dubbo-configcenter-zookeeper-cache/pom.xml |  53 
 apache.dubbo.configcenter.DynamicConfiguration |   1 -
 .../ZookeeperDynamicConfigurationTest.java | 150 
 .../dubbo-configcenter-zookeeper/pom.xml   |  19 +-
 .../support/zookeeper/CacheListener.java   |   1 -
 .../zookeeper/ZookeeperDynamicConfiguration.java   |   0
 dubbo-configcenter/pom.xml |   2 -
 dubbo-dependencies-bom/pom.xml |  12 -
 12 files changed, 3 insertions(+), 720 deletions(-)

diff --git a/dubbo-configcenter/dubbo-configcenter-archaius/pom.xml 
b/dubbo-configcenter/dubbo-configcenter-archaius/pom.xml
deleted file mode 100644
index a122d72..000
--- a/dubbo-configcenter/dubbo-configcenter-archaius/pom.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-http://www.w3.org/2001/XMLSchema-instance; 
xmlns="http://maven.apache.org/POM/4.0.0;
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd;>
-4.0.0
-
-org.apache.dubbo
-dubbo-configcenter
-2.7.0-SNAPSHOT
-
-dubbo-configcenter-archaius
-jar
-${project.artifactId}
-The archaius implementation of the config-center 
api
-
-
-
-org.apache.dubbo
-dubbo-configcenter-api
-${project.parent.version}
-
-
-com.netflix.archaius
-archaius-core
-
-
-org.apache.curator
-curator-framework
-
-
-org.apache.curator
-curator-recipes
-
-
-commons-configuration
-commons-configuration
-
-
-
\ No newline at end of file
diff --git 
a/dubbo-configcenter/dubbo-configcenter-archaius/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ArchaiusDynamicConfiguration.java
 
b/dubbo-configcenter/dubbo-configcenter-archaius/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ArchaiusDynamicConfiguration.java
deleted file mode 100644
index e0c64e3..000
--- 
a/dubbo-configcenter/dubbo-configcenter-archaius/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ArchaiusDynamicConfiguration.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 org.apache.dubbo.configcenter.support.zookeeper;
-
-import com.netflix.config.ConfigurationManager;
-import com.netflix.config.DynamicPropertyFactory;
-import com.netflix.config.DynamicStringProperty;
-import com.netflix.config.DynamicWatchedConfiguration;
-import org.apache.dubbo.common.Constants;
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.logger.Logger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-import org.apache.dubbo.common.utils.ConcurrentHashSet;
-import org.apache.dubbo.common.utils.StringUtils;
-import org.apache.dubbo.configcenter.AbstractDynamicConfiguration;
-import org.apache.dubbo.configcenter.ConfigChangeEvent;
-import org.apache.dubbo.configcenter.ConfigChangeType;
-import org.apache.dubbo.configcenter.ConfigType;
-import org.apache.dubbo.configcenter.ConfigurationListener;
-import 
org.apache.dubbo.configcenter.support.zookeeper.sources.ZooKeeperConfigurationSource;
-
-import java.util.Set;
-
-import static org.apache.dubbo.common.Constants.CONFIG_NAMESPACE_KEY;
-import static 
org.apache.dubbo.configcenter.support.zookeeper.sources.ZooKeeperConfigurationSource.ARCHAIUS_CONFIG_CHECK_KEY;
-import static 

[incubator-dubbo] 02/06: Add UT for Configuration

2018-11-27 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git

commit b9ce4a490c642c15f70ee4f19c00af8ef1423c40
Author: ken.lj 
AuthorDate: Sat Nov 24 15:21:50 2018 +0800

Add UT for Configuration
---
 .../apache/dubbo/common/config/Environment.java|  18 +-
 .../dubbo/common/config/InmemoryConfiguration.java |  13 +-
 .../org/apache/dubbo/common/utils/ConfigUtils.java |  15 +-
 .../org/apache/dubbo/config/AbstractConfig.java|   5 +-
 .../org/apache/dubbo/config/ApplicationConfig.java |   2 +-
 .../apache/dubbo/config/ConfigCenterConfig.java|  49 ++---
 .../org/apache/dubbo/config/support/Parameter.java |   2 +-
 .../apache/dubbo/config/AbstractConfigTest.java| 241 +
 .../apache/dubbo/config/RegistryConfigTest.java|   1 +
 .../src/test/resources/dubbo.properties|   2 +
 10 files changed, 312 insertions(+), 36 deletions(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java 
b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
index bc58ec9..11aabd5 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
@@ -61,7 +61,7 @@ public class Environment {
 public InmemoryConfiguration getExternalConfig(String prefix, String id) {
 return externalConfigs.computeIfAbsent(toKey(prefix, id), k -> {
 InmemoryConfiguration configuration = new 
InmemoryConfiguration(prefix, id);
-configuration.addProperties(externalConfigurationMap);
+configuration.setProperties(externalConfigurationMap);
 return configuration;
 });
 }
@@ -69,7 +69,7 @@ public class Environment {
 public InmemoryConfiguration getAppExternalConfig(String prefix, String 
id) {
 return appExternalConfigs.computeIfAbsent(toKey(prefix, id), k -> {
 InmemoryConfiguration configuration = new 
InmemoryConfiguration(prefix, id);
-configuration.addProperties(appExternalConfigurationMap);
+configuration.setProperties(appExternalConfigurationMap);
 return configuration;
 });
 }
@@ -82,11 +82,11 @@ public class Environment {
 return appConfigs.get(toKey(prefix, id));
 }
 
-public synchronized void setExternalConfig(Map 
externalConfiguration) {
+public void setExternalConfig(Map externalConfiguration) {
 this.externalConfigurationMap = externalConfiguration;
 }
 
-public synchronized void setAppExternalConfig(Map 
appExternalConfiguration) {
+public void setAppExternalConfig(Map 
appExternalConfiguration) {
 this.appExternalConfigurationMap = appExternalConfiguration;
 }
 
@@ -168,4 +168,14 @@ public class Environment {
 public void setDynamicConfiguration(Configuration dynamicConfiguration) {
 this.dynamicConfiguration = dynamicConfiguration;
 }
+
+// For test
+public void clearExternalConfigs() {
+this.externalConfigs.clear();
+}
+
+// For test
+public void clearAppExternalConfigs() {
+this.appExternalConfigs.clear();
+}
 }
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/config/InmemoryConfiguration.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/config/InmemoryConfiguration.java
index b4a9c48..76b6062 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/config/InmemoryConfiguration.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/config/InmemoryConfiguration.java
@@ -51,6 +51,17 @@ public class InmemoryConfiguration extends 
AbstractPrefixConfiguration {
  * Add a set of properties into the store
  */
 public void addProperties(Map properties) {
-store.putAll(properties);
+if (properties != null) {
+this.store.putAll(properties);
+}
+}
+
+/**
+ * set store
+ */
+public void setProperties(Map properties) {
+if (properties != null) {
+this.store = properties;
+}
 }
 }
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java 
b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java
index fbab5ea..a67c8f5 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java
@@ -21,6 +21,7 @@ import org.apache.dubbo.common.extension.ExtensionLoader;
 import org.apache.dubbo.common.logger.Logger;
 import org.apache.dubbo.common.logger.LoggerFactory;
 
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.lang.management.ManagementFactory;
@@ -218,7 +219,7 @@ public class ConfigUtils {
 public static Properties loadProperties(String 

[incubator-dubbo] branch dev-metadata updated (8d8aed2 -> d9e0b64)

2018-11-27 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a change to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git.


from 8d8aed2  Merge pull request #2823, Code review for ConfigurationUtils 
and Environment.
 new 3206dba  store DynamicConfiguration reference in Environment
 new b9ce4a4  Add UT for Configuration
 new 6f61822  try different zookeeper implementations
 new bc3086e  add unit tests
 new d4156cc  upgrade curator version
 new d9e0b64  save one zookeeper implementation as default

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/dubbo/common/config/Environment.java|  35 ++-
 .../dubbo/common/config/InmemoryConfiguration.java |  13 +-
 .../dubbo/common/extension/ExtensionLoader.java|   9 -
 .../org/apache/dubbo/common/utils/ConfigUtils.java |  15 +-
 .../AbstractPrefixConfigurationTest.java}  |   7 +-
 .../common/config/CompositeConfigurationTest.java  |   9 +-
 .../dubbo/common/config/EnvironmentTest.java   |  12 +-
 .../org/apache/dubbo/config/AbstractConfig.java|   5 +-
 .../dubbo/config/AbstractInterfaceConfig.java  |   6 +-
 .../org/apache/dubbo/config/ApplicationConfig.java |   2 +-
 .../apache/dubbo/config/ConfigCenterConfig.java|  54 ++---
 .../org/apache/dubbo/config/support/Parameter.java |   2 +-
 .../apache/dubbo/config/AbstractConfigTest.java| 241 ++
 .../apache/dubbo/config/RegistryConfigTest.java|   1 +
 .../src/test/resources/dubbo.properties|   2 +
 .../configcenter/AbstractDynamicConfiguration.java |  31 +--
 .../dubbo/configcenter/ConfigChangeEvent.java  |  16 +-
 .../dubbo/configcenter/ConfigurationUtils.java |  12 +-
 .../dubbo/configcenter/DynamicConfiguration.java   |   2 +
 .../support/nop/NopDynamicConfiguration.java   |   9 +-
 .../mock/MockDynamicConfiguration.java |   9 +-
 apache.dubbo.configcenter.DynamicConfiguration |   1 +
 .../support/apollo/ApolloDynamicConfiguration.java |  48 ++--
 .../dubbo-configcenter-zookeeper/pom.xml   |  11 +-
 .../archaius/ArchaiusDynamicConfiguration.java | 163 -
 .../sources/ZooKeeperConfigurationSource.java  | 268 -
 .../support/zookeeper/CacheListener.java   | 106 
 .../zookeeper/ZookeeperDynamicConfiguration.java   | 144 +++
 apache.dubbo.configcenter.DynamicConfiguration |   3 +-
 .../ZookeeperDynamicConfigurationTest.java | 150 
 dubbo-configcenter/pom.xml |   4 +-
 dubbo-dependencies-bom/pom.xml |  16 +-
 dubbo-remoting/dubbo-remoting-zookeeper/pom.xml|   1 -
 33 files changed, 819 insertions(+), 588 deletions(-)
 copy 
dubbo-common/src/test/java/org/apache/dubbo/common/{compiler/support/internal/HelloServiceInternalImpl.java
 => config/AbstractPrefixConfigurationTest.java} (89%)
 copy 
dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/Cleanable.java
 => 
dubbo-common/src/test/java/org/apache/dubbo/common/config/CompositeConfigurationTest.java
 (89%)
 copy 
dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/api/Box.java
 => 
dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentTest.java 
(90%)
 create mode 100644 
dubbo-config/dubbo-config-api/src/test/resources/dubbo.properties
 copy 
dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/Cleanable.java
 => 
dubbo-configcenter/dubbo-configcenter-api/src/test/java/org/apache/dubbo/configcenter/mock/MockDynamicConfiguration.java
 (89%)
 create mode 100644 
dubbo-configcenter/dubbo-configcenter-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.configcenter.DynamicConfiguration
 delete mode 100644 
dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/archaius/ArchaiusDynamicConfiguration.java
 delete mode 100644 
dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/archaius/sources/ZooKeeperConfigurationSource.java
 create mode 100644 
dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/CacheListener.java
 create mode 100644 
dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfiguration.java
 create mode 100644 
dubbo-configcenter/dubbo-configcenter-zookeeper/src/test/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfigurationTest.java



[incubator-dubbo] 01/06: store DynamicConfiguration reference in Environment

2018-11-27 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git

commit 3206dba956ae1d23fab1a2099ffd166974fe0ba9
Author: ken.lj 
AuthorDate: Fri Nov 23 20:10:01 2018 +0800

store DynamicConfiguration reference in Environment
---
 .../org/apache/dubbo/common/config/Environment.java | 17 +++--
 .../apache/dubbo/common/extension/ExtensionLoader.java  |  9 -
 .../apache/dubbo/config/AbstractInterfaceConfig.java|  6 +-
 .../org/apache/dubbo/config/ConfigCenterConfig.java |  5 +
 .../apache/dubbo/configcenter/ConfigurationUtils.java   | 12 
 5 files changed, 21 insertions(+), 28 deletions(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java 
b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
index 746fbc3..bc58ec9 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
@@ -36,11 +36,16 @@ public class Environment {
 private Map appExternalConfigs = new 
ConcurrentHashMap<>();
 private Map appConfigs = new 
ConcurrentHashMap<>();
 
-private boolean configCenterFirst = true;
-
 private Map externalConfigurationMap = new HashMap<>();
 private Map appExternalConfigurationMap = new HashMap<>();
 
+private boolean configCenterFirst = true;
+
+/**
+ * FIXME, this instance will always be a type of DynamicConfiguration, 
ConfigCenterConfig will load the instance at startup and assign it to here.
+ */
+private Configuration dynamicConfiguration;
+
 public static Environment getInstance() {
 return INSTANCE;
 }
@@ -155,4 +160,12 @@ public class Environment {
 public void setConfigCenterFirst(boolean configCenterFirst) {
 this.configCenterFirst = configCenterFirst;
 }
+
+public Configuration getDynamicConfiguration() {
+return dynamicConfiguration;
+}
+
+public void setDynamicConfiguration(Configuration dynamicConfiguration) {
+this.dynamicConfiguration = dynamicConfiguration;
+}
 }
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java
index 83a6c7f..1c0b62f 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java
@@ -44,7 +44,6 @@ import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.regex.Pattern;
-import java.util.stream.Collectors;
 
 /**
  * Load dubbo extensions
@@ -337,14 +336,6 @@ public class ExtensionLoader {
 }
 
 /**
- * Return all available extension instances.
- */
-public Set getExtensions() {
-return 
Collections.unmodifiableSet(getSupportedExtensions().stream().map(this::getExtension)
-.collect(Collectors.toSet()));
-}
-
-/**
  * Return default extension, return null if it's not 
configured.
  */
 public T getDefaultExtension() {
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
index 438534d..be5b9e1 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
@@ -20,14 +20,12 @@ import org.apache.dubbo.common.Constants;
 import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.Version;
 import org.apache.dubbo.common.config.Environment;
-import org.apache.dubbo.common.utils.CollectionUtils;
 import org.apache.dubbo.common.utils.ConfigUtils;
 import org.apache.dubbo.common.utils.NetUtils;
 import org.apache.dubbo.common.utils.ReflectUtils;
 import org.apache.dubbo.common.utils.StringUtils;
 import org.apache.dubbo.common.utils.UrlUtils;
 import org.apache.dubbo.config.support.Parameter;
-import org.apache.dubbo.configcenter.DynamicConfiguration;
 import org.apache.dubbo.metadata.integration.MetadataReportService;
 import org.apache.dubbo.monitor.MonitorFactory;
 import org.apache.dubbo.monitor.MonitorService;
@@ -43,7 +41,6 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import static org.apache.dubbo.common.Constants.APPLICATION_KEY;
 import static 
org.apache.dubbo.common.extension.ExtensionLoader.getExtensionLoader;
@@ -165,9 +162,8 @@ public abstract class AbstractInterfaceConfig extends 
AbstractMethodConfig {
 private void 

[incubator-dubbo] 05/06: upgrade curator version

2018-11-27 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git

commit d4156cc6bd16a5c43a50ce423f37c4473397
Author: ken.lj 
AuthorDate: Tue Nov 27 17:31:16 2018 +0800

upgrade curator version
---
 dubbo-dependencies-bom/pom.xml  | 4 ++--
 dubbo-remoting/dubbo-remoting-zookeeper/pom.xml | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml
index 1ecb57b..16a9d98 100644
--- a/dubbo-dependencies-bom/pom.xml
+++ b/dubbo-dependencies-bom/pom.xml
@@ -81,9 +81,9 @@
 4.5.3
 4.4.6
 1.2.46
-3.4.9
+3.4.13
 0.2
-2.12.0
+4.0.1
 2.9.0
 1.3.6
 3.1.15
diff --git a/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml 
b/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml
index e7a0298..807c1e5 100644
--- a/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml
+++ b/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml
@@ -48,7 +48,6 @@
 
 org.apache.curator
 curator-recipes
-2.12.0
 
 
 org.apache.curator



[incubator-dubbo] 04/06: add unit tests

2018-11-27 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git

commit bc3086e7fb08a734b51082b6130a417e2a5dffd3
Author: ken.lj 
AuthorDate: Tue Nov 27 17:30:57 2018 +0800

add unit tests
---
 .../config/AbstractPrefixConfigurationTest.java| 23 ++
 .../common/config/CompositeConfigurationTest.java  | 23 ++
 .../dubbo/common/config/EnvironmentTest.java   | 23 ++
 3 files changed, 69 insertions(+)

diff --git 
a/dubbo-common/src/test/java/org/apache/dubbo/common/config/AbstractPrefixConfigurationTest.java
 
b/dubbo-common/src/test/java/org/apache/dubbo/common/config/AbstractPrefixConfigurationTest.java
new file mode 100644
index 000..ba4b5b8
--- /dev/null
+++ 
b/dubbo-common/src/test/java/org/apache/dubbo/common/config/AbstractPrefixConfigurationTest.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.dubbo.common.config;
+
+/**
+ *
+ */
+public class AbstractPrefixConfigurationTest {
+}
diff --git 
a/dubbo-common/src/test/java/org/apache/dubbo/common/config/CompositeConfigurationTest.java
 
b/dubbo-common/src/test/java/org/apache/dubbo/common/config/CompositeConfigurationTest.java
new file mode 100644
index 000..fd96ab7
--- /dev/null
+++ 
b/dubbo-common/src/test/java/org/apache/dubbo/common/config/CompositeConfigurationTest.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.dubbo.common.config;
+
+/**
+ *
+ */
+public class CompositeConfigurationTest {
+}
diff --git 
a/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentTest.java
 
b/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentTest.java
new file mode 100644
index 000..994532f
--- /dev/null
+++ 
b/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentTest.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.dubbo.common.config;
+
+/**
+ *
+ */
+public class EnvironmentTest {
+}



[incubator-dubbo] 03/06: try different zookeeper implementations

2018-11-27 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git

commit 6f618226c179f76cf921f4792df6878320917ef1
Author: ken.lj 
AuthorDate: Tue Nov 27 17:29:09 2018 +0800

try different zookeeper implementations
---
 .../configcenter/AbstractDynamicConfiguration.java |  31 +++--
 .../dubbo/configcenter/ConfigChangeEvent.java  |  16 +--
 .../dubbo/configcenter/DynamicConfiguration.java   |   2 +
 .../support/nop/NopDynamicConfiguration.java   |   9 +-
 .../mock/MockDynamicConfiguration.java |  23 
 apache.dubbo.configcenter.DynamicConfiguration |   1 +
 .../support/apollo/ApolloDynamicConfiguration.java |  48 ---
 .../pom.xml|   4 +-
 .../zookeeper}/ArchaiusDynamicConfiguration.java   |  60 -
 .../sources/ZooKeeperConfigurationSource.java  |   4 +-
 apache.dubbo.configcenter.DynamicConfiguration |   1 +
 .../pom.xml|  16 +--
 .../support/zookeeper/CacheListener.java   | 107 +++
 .../zookeeper/ZookeeperDynamicConfiguration.java   | 144 
 apache.dubbo.configcenter.DynamicConfiguration |   1 +
 .../ZookeeperDynamicConfigurationTest.java | 150 +
 .../dubbo-configcenter-zookeeper/pom.xml   |  30 +++--
 apache.dubbo.configcenter.DynamicConfiguration |   3 +-
 .../ZookeeperDynamicConfigurationTest.java | 150 +
 dubbo-configcenter/pom.xml |   6 +-
 20 files changed, 699 insertions(+), 107 deletions(-)

diff --git 
a/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
 
b/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
index 258ce52..6fcf8c3 100644
--- 
a/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
+++ 
b/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
@@ -26,8 +26,8 @@ import java.util.concurrent.ConcurrentMap;
  * Dynamic configuration template class. The concrete implementation needs to 
provide implementation for three methods.
  *
  * @see AbstractDynamicConfiguration#getTargetConfig(String, String, long)
- * @see AbstractDynamicConfiguration#addListener(String, ConfigurationListener)
- * @see AbstractDynamicConfiguration#createTargetListener(String, 
ConfigurationListener)
+ * @see AbstractDynamicConfiguration#addConfigurationListener(TargetListener, 
ConfigurationListener)
+ * @see AbstractDynamicConfiguration#createTargetListener(String)
  */
 public abstract class AbstractDynamicConfiguration extends 
AbstractConfiguration
 implements DynamicConfiguration {
@@ -36,7 +36,7 @@ public abstract class 
AbstractDynamicConfiguration extends Abstr
 protected URL url;
 
 // One key can register multiple target listeners, but one target listener 
only maps to one configuration listener
-private ConcurrentMap> targetListeners =
+protected ConcurrentMap targetListeners =
 new ConcurrentHashMap<>();
 
 public AbstractDynamicConfiguration() {
@@ -49,11 +49,8 @@ public abstract class 
AbstractDynamicConfiguration extends Abstr
 
 @Override
 public void addListener(String key, ConfigurationListener listener) {
-ConcurrentMap listeners = 
targetListeners.computeIfAbsent(key,
-k -> new ConcurrentHashMap<>());
-TargetListener targetListener = listeners.computeIfAbsent(listener,
-k -> createTargetListener(key, listener));
-addTargetListener(key, targetListener);
+TargetListener targetListener = targetListeners.computeIfAbsent(key, 
this::createTargetListener);
+addConfigurationListener(key, targetListener, listener);
 }
 
 @Override
@@ -88,6 +85,13 @@ public abstract class 
AbstractDynamicConfiguration extends Abstr
 }
 }
 
+@Override
+public void removeListener(String key) {
+
+}
+
+protected abstract void recover();
+
 /**
  * Fetch dynamic configuration from backend config storage. If timeout 
exceeds, exception should be thrown.
  *
@@ -101,20 +105,19 @@ public abstract class 
AbstractDynamicConfiguration extends Abstr
 /**
  * Register a native listener to the backend config storage so that Dubbo 
has chance to get notified when the
  * value changes.
- *
- * @param key  property key listener is interested.
- * @param listener native listener for the backend config storage
+ * @param key
+ * @param targetListener Implementation dependent listener, such as, 
zookeeper watcher, Apollo listener, ...
+ * @param configurationListener Listener in Dubbo that