This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new 4fc0796  SCB-2172 - Multi-frame docking ServiceComb-Kie unified Kie 
Client common code (#2168)
4fc0796 is described below

commit 4fc079654b1173241e976c354ea1feb712f00e5c
Author: zyl <[email protected]>
AuthorDate: Tue Dec 29 09:29:42 2020 +0800

    SCB-2172 - Multi-frame docking ServiceComb-Kie unified Kie Client common 
code (#2168)
    
    * SCB-2172 - Multi-frame docking ServiceComb-Kie unified Kie Client common 
code
    
    * SCB-2172 - Multi-frame docking ServiceComb-Kie unified Kie Client common 
code
---
 clients/{kie-client => config-kie-client}/pom.xml  |  48 +----
 .../servicecomb/config/kie/client/KieClient.java   | 239 +++++++++++++++++++++
 .../config/kie/client/KieConfigChangedEvent.java}  |  30 +--
 .../config/kie/client/KieConfigManager.java        |  77 +++++++
 .../config/kie/client/KieConfigOperation.java      |  33 +++
 .../kie/client/exception/OperationException.java}  |  22 +-
 .../config/kie/client/model/ConfigConstants.java}  |  87 ++++----
 .../kie/client/model/ConfigurationsRequest.java    |  75 +++++++
 .../kie/client/model/ConfigurationsResponse.java}  | 113 +++++-----
 .../config}/kie/client/model/KVDoc.java            | 237 ++++++++++----------
 .../config}/kie/client/model/KVResponse.java       |  96 +++++----
 .../config/kie/client/model/KieAddressManager.java |  67 ++++++
 .../config}/kie/client/model/LabelDocResponse.java |  94 ++++----
 .../config/kie/client/model/ValueType.java}        |  20 +-
 clients/kie-client/README.md                       |  88 --------
 .../apache/servicecomb/kie/client/KieClient.java   | 160 --------------
 .../servicecomb/kie/client/KieRawClient.java       | 188 ----------------
 .../servicecomb/kie/client/http/HttpResponse.java  |  61 ------
 .../kie/client/http/HttpTransportImpl.java         | 120 -----------
 .../servicecomb/kie/client/HttpTransportTest.java  |  64 ------
 .../servicecomb/kie/client/KieClientTest.java      | 146 -------------
 .../servicecomb/kie/client/KieRawClientTest.java   |  75 -------
 clients/pom.xml                                    |   2 +-
 23 files changed, 839 insertions(+), 1303 deletions(-)

diff --git a/clients/kie-client/pom.xml b/clients/config-kie-client/pom.xml
old mode 100755
new mode 100644
similarity index 52%
rename from clients/kie-client/pom.xml
rename to clients/config-kie-client/pom.xml
index 950a03b..b25052c
--- a/clients/kie-client/pom.xml
+++ b/clients/config-kie-client/pom.xml
@@ -19,7 +19,6 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0";
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-
     <parent>
         <artifactId>clients</artifactId>
         <groupId>org.apache.servicecomb</groupId>
@@ -27,52 +26,17 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>kie-client</artifactId>
-    <name>ServiceComb::Kie::Client</name>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
+    <artifactId>config-kie-client</artifactId>
     <dependencies>
         <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpclient</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
+            <groupId>org.apache.servicecomb</groupId>
+            <artifactId>http-client-common</artifactId>
         </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-
         <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-core</artifactId>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
         </dependency>
     </dependencies>
 
+
 </project>
\ No newline at end of file
diff --git 
a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java
new file mode 100644
index 0000000..6b24969
--- /dev/null
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java
@@ -0,0 +1,239 @@
+/*
+ * 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.servicecomb.config.kie.client;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpStatus;
+import org.apache.servicecomb.config.kie.client.exception.OperationException;
+import org.apache.servicecomb.config.kie.client.model.ConfigConstants;
+import org.apache.servicecomb.config.kie.client.model.ConfigurationsRequest;
+import org.apache.servicecomb.config.kie.client.model.ConfigurationsResponse;
+import org.apache.servicecomb.config.kie.client.model.KVDoc;
+import org.apache.servicecomb.config.kie.client.model.KVResponse;
+import org.apache.servicecomb.config.kie.client.model.KieAddressManager;
+import org.apache.servicecomb.config.kie.client.model.ValueType;
+import org.apache.servicecomb.http.client.common.HttpRequest;
+import org.apache.servicecomb.http.client.common.HttpResponse;
+import org.apache.servicecomb.http.client.common.HttpTransport;
+import org.apache.servicecomb.http.client.common.HttpUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
+import org.springframework.core.io.ByteArrayResource;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class KieClient implements KieConfigOperation {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(KieClient.class);
+
+  private AtomicBoolean isFirst = new AtomicBoolean(true);
+
+  protected HttpTransport httpTransport;
+
+  protected String revision = "0";
+
+  private String url;
+
+  private HttpResponse httpResponse = null;
+
+  private KieAddressManager addressManager;
+
+  private Map<String, String> labelsMap;
+
+  public static final String DEFAULT_KIE_API_VERSION = "v1";
+
+  public KieClient(KieAddressManager addressManager, HttpTransport 
httpTransport) {
+    this.httpTransport = httpTransport;
+    this.addressManager = addressManager;
+  }
+
+  @Override
+  public ConfigurationsResponse queryConfigurations(ConfigurationsRequest 
request) {
+    boolean isWatch = false;
+    if 
(Boolean.valueOf(getPropertiesValue(getConfigKeyValue(ConfigConstants.KEY_ENABLELONGPOLLING))))
 {
+      isWatch = true;
+    }
+    try {
+      url = addressManager.address()
+          + "/"
+          + DEFAULT_KIE_API_VERSION
+          + "/"
+          + getPropertiesValue(getConfigKeyValue(ConfigConstants.KEY_PROJECT))
+          + "/kie/kv?label=app:"
+          //app 名称作为筛选条件
+          + request.getApplication()
+          + "&revision="
+          + revision;
+
+      if (isWatch && !isFirst.get()) {
+        url +=
+            "&wait=" + 
getPropertiesValue(getConfigKeyValue(ConfigConstants.KEY_POLLINGWAITSEC)) + "s";
+      }
+      isFirst.compareAndSet(true, false);
+      Map<String, String> headers = new HashMap<>();
+      headers.put("environment", request.getEnvironment());
+      HttpRequest httpRequest = new HttpRequest(url, headers, null, 
HttpRequest.GET);
+      httpResponse = httpTransport.doRequest(httpRequest);
+      if (httpResponse == null) {
+        return null;
+      }
+      ConfigurationsResponse configurationsResponse = new 
ConfigurationsResponse();
+      if (httpResponse.getStatusCode() == HttpStatus.SC_OK) {
+        revision = httpResponse.getHeader("X-Kie-Revision");
+        KVResponse allConfigList = 
HttpUtils.deserialize(httpResponse.getContent(), KVResponse.class);
+        Map<String, Object> configurations = getConfigByLabel(allConfigList, 
request);
+        configurationsResponse.setConfigurations(configurations);
+        configurationsResponse.setChanged(true);
+        configurationsResponse.setRevision(revision);
+        return configurationsResponse;
+      }
+      if (httpResponse.getStatusCode() == HttpStatus.SC_BAD_REQUEST) {
+        throw new OperationException("Bad request for query configurations.");
+      }
+      if (httpResponse.getStatusCode() == HttpStatus.SC_NOT_MODIFIED) {
+        configurationsResponse.setChanged(false);
+        return configurationsResponse;
+      }
+      throw new OperationException(
+          "read response failed. status:" + httpResponse.getStatusCode() + "; 
message:" +
+              httpResponse.getMessage() + "; content:" + 
httpResponse.getContent());
+
+    } catch (Exception e) {
+      addressManager.nextAddress();
+      throw new OperationException("read response failed. ", e);
+    }
+  }
+
+  private Map<String, Object> getConfigByLabel(KVResponse resp, 
ConfigurationsRequest request) {
+    Map<String, Object> resultMap = new HashMap<>();
+    List<KVDoc> appList = new ArrayList<>();
+    List<KVDoc> serviceList = new ArrayList<>();
+    List<KVDoc> versionList = new ArrayList<>();
+    for (KVDoc kvDoc : resp.getData()) {
+      if (!StringUtils.isEmpty(kvDoc.getStatus()) && !kvDoc.getStatus()
+          .equals(ConfigConstants.STATUS_ENABLED)) {
+        continue;
+      }
+      labelsMap = kvDoc.getLabels();
+      boolean checkApplication = checkValue(ConfigConstants.LABEL_APP, 
request.getApplication());
+      boolean checkEnvironment = checkValue(ConfigConstants.LABEL_ENV, 
request.getEnvironment());
+      boolean checkServer = checkValue(ConfigConstants.LABEL_SERVICE, 
request.getServiceName());
+      boolean checkVersion = checkValue(ConfigConstants.LABEL_VERSION, 
request.getVersion());
+      if (checkApplication && checkEnvironment && 
!labelsMap.containsKey(ConfigConstants.LABEL_SERVICE)) {
+          appList.add(kvDoc);
+      }
+      if (checkApplication && checkEnvironment && checkServer && 
!kvDoc.getLabels().containsKey(ConfigConstants.LABEL_VERSION)) {
+        serviceList.add(kvDoc);
+      }
+      if (checkApplication && checkEnvironment && checkServer && checkVersion) 
{
+        versionList.add(kvDoc);
+      }
+    }
+    //kv is priority
+    for (KVDoc kvDoc : appList) {
+      resultMap.putAll(processValueType(kvDoc));
+    }
+    for (KVDoc kvDoc : serviceList) {
+      resultMap.putAll(processValueType(kvDoc));
+    }
+    for (KVDoc kvDoc : versionList) {
+      resultMap.putAll(processValueType(kvDoc));
+    }
+    return resultMap;
+  }
+
+  private boolean checkValue(String key, String propertyName) {
+    if (!labelsMap.containsKey(key)) {
+      return false;
+    }
+    if (!labelsMap.get(key).equals(propertyName)) {
+      return false;
+    }
+    return true;
+  }
+
+  private Map<String, Object> processValueType(KVDoc kvDoc) {
+    ValueType vtype;
+    try {
+      vtype = ValueType.valueOf(kvDoc.getValueType());
+    } catch (IllegalArgumentException e) {
+      throw new OperationException("value type not support");
+    }
+    Properties properties = new Properties();
+    Map<String, Object> kvMap = new HashMap<>();
+    try {
+      switch (vtype) {
+        case yml:
+        case yaml:
+          YamlPropertiesFactoryBean yamlFactory = new 
YamlPropertiesFactoryBean();
+          yamlFactory.setResources(new 
ByteArrayResource(kvDoc.getValue().getBytes()));
+          return toMap(kvDoc.getKey(), yamlFactory.getObject());
+        case properties:
+          properties.load(new StringReader(kvDoc.getValue()));
+          return toMap(kvDoc.getKey(), properties);
+        case text:
+        case string:
+        default:
+          kvMap.put(kvDoc.getKey(), kvDoc.getValue());
+          return kvMap;
+      }
+    } catch (Exception e) {
+      LOGGER.error("read config failed");
+    }
+    return Collections.emptyMap();
+  }
+
+  @SuppressWarnings("unchecked")
+  private Map<String, Object> toMap(String prefix, Properties properties) {
+    if (properties == null) {
+      return Collections.emptyMap();
+    }
+    Map<String, Object> result = new HashMap<>();
+    Enumeration<String> keys = (Enumeration<String>) 
properties.propertyNames();
+    while (keys.hasMoreElements()) {
+      String key = keys.nextElement();
+      Object value = properties.getProperty(key);
+      if (!StringUtils.isEmpty(prefix)) {
+        key = prefix + "." + key;
+      }
+      if (value != null) {
+        result.put(key, value);
+      } else {
+        result.put(key, null);
+      }
+    }
+    return result;
+  }
+
+  private String getPropertiesValue(String key) {
+    return this.addressManager.getProperties().getProperty(key);
+  }
+
+  private String getConfigKeyValue(String key) {
+    return this.addressManager.getConfigKey().get(key);
+  }
+}
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpRequest.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigChangedEvent.java
old mode 100755
new mode 100644
similarity index 63%
rename from 
clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpRequest.java
rename to 
clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigChangedEvent.java
index 24a75c7..ab060d7
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpRequest.java
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigChangedEvent.java
@@ -15,33 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.kie.client.http;
+package org.apache.servicecomb.config.kie.client;
 
 import java.util.Map;
 
-public class HttpRequest {
+public class KieConfigChangedEvent {
+  private Map<String, Object> configurations;
 
-  private String url;
-
-  private Map<String, String> headers;
-
-  private String content;
-
-  public HttpRequest(String url, Map<String, String> headers, String content) {
-    this.url = url;
-    this.headers = headers;
-    this.content = content;
-  }
-
-  public String getUrl() {
-    return url;
+  public KieConfigChangedEvent(Map<String, Object> configurations) {
+    this.configurations = configurations;
   }
 
-  public Map<String, String> getHeaders() {
-    return headers;
+  public Map<String, Object> getConfigurations() {
+    return configurations;
   }
 
-  public String getContent() {
-    return content;
+  public KieConfigChangedEvent setConfigurations(Map<String, Object> 
configurations) {
+    this.configurations = configurations;
+    return this;
   }
 }
diff --git 
a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java
new file mode 100644
index 0000000..790d2f6
--- /dev/null
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java
@@ -0,0 +1,77 @@
+/*
+ * 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.servicecomb.config.kie.client;
+
+import com.google.common.eventbus.EventBus;
+import org.apache.servicecomb.config.kie.client.model.ConfigurationsRequest;
+import org.apache.servicecomb.config.kie.client.model.ConfigurationsResponse;
+import org.apache.servicecomb.http.client.task.AbstractTask;
+import org.apache.servicecomb.http.client.task.Task;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class KieConfigManager extends AbstractTask {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(KieConfigManager.class);
+
+  private static long POLL_INTERVAL = 1000;
+
+  private KieConfigOperation configKieClient;
+
+  private final EventBus eventBus;
+
+  private ConfigurationsRequest configurationsRequest;
+
+  public KieConfigManager(KieConfigOperation configKieClient, EventBus 
eventBus) {
+    super("config-center-configuration-task");
+    this.configKieClient = configKieClient;
+    this.eventBus = eventBus;
+  }
+
+  public void setConfigurationsRequest(ConfigurationsRequest 
configurationsRequest) {
+    this.configurationsRequest = configurationsRequest;
+  }
+
+  public void startConfigKieManager() {
+    this.startTask(new PollConfigurationTask(0));
+  }
+
+  class PollConfigurationTask implements Task {
+    int failCount = 0;
+
+    public PollConfigurationTask(int failCount) {
+      this.failCount = failCount;
+    }
+
+    @Override
+    public void execute() {
+      try {
+        ConfigurationsResponse response = 
configKieClient.queryConfigurations(configurationsRequest);
+        if (response.isChanged()) {
+          LOGGER.info("The configurations are change, will refresh local 
configurations.");
+          configurationsRequest.setRevision(response.getRevision());
+          eventBus.post(new 
KieConfigChangedEvent(response.getConfigurations()));
+        }
+        startTask(new BackOffSleepTask(POLL_INTERVAL, new 
PollConfigurationTask(0)));
+      } catch (Exception e) {
+        LOGGER.error("get configurations from KieConfigCenter failed, and will 
try again.", e);
+        startTask(new BackOffSleepTask(failCount + 1, new 
PollConfigurationTask(failCount + 1)));
+      }
+    }
+  }
+}
diff --git 
a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigOperation.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigOperation.java
new file mode 100644
index 0000000..1079a1f
--- /dev/null
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigOperation.java
@@ -0,0 +1,33 @@
+/*
+ * 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.servicecomb.config.kie.client;
+
+import org.apache.servicecomb.config.kie.client.exception.OperationException;
+import org.apache.servicecomb.config.kie.client.model.ConfigurationsRequest;
+import org.apache.servicecomb.config.kie.client.model.ConfigurationsResponse;
+
+//此处支持配置中心扩展
+public interface KieConfigOperation {
+  /**
+   * 根据查询条件查询配置项。
+   * @param request 查询的维度(project, application, serviceName, version) 和 
revision 信息。
+   * @return 如果存在配置变更,返回全量的配置项, changed = true。 如果没有变更, 返回 null, changed = 
false,
+   *  @throws OperationException If some problems happened to contact service 
center or non http 200 returned.
+   */
+  ConfigurationsResponse queryConfigurations(ConfigurationsRequest request);
+}
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpTransport.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/exception/OperationException.java
old mode 100755
new mode 100644
similarity index 67%
rename from 
clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpTransport.java
rename to 
clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/exception/OperationException.java
index 447aa4f..fa14be9
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpTransport.java
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/exception/OperationException.java
@@ -15,20 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.kie.client.http;
+package org.apache.servicecomb.config.kie.client.exception;
 
-import java.io.IOException;
+public class OperationException extends RuntimeException {
+  private static final long serialVersionUID = 1L;
 
-/**
- * Created by   on 2019/10/16.
- */
-public interface HttpTransport {
-
-  HttpResponse get(HttpRequest request) throws IOException;
-
-  HttpResponse post(HttpRequest request) throws IOException;
-
-  HttpResponse put(HttpRequest request) throws IOException;
+  public OperationException(String message) {
+    super(message);
+  }
 
-  HttpResponse delete(HttpRequest request) throws IOException;
+  public OperationException(String message, Throwable cause) {
+    super(message, cause);
+  }
 }
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/LabelDocResponse.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigConstants.java
old mode 100755
new mode 100644
similarity index 56%
copy from 
clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/LabelDocResponse.java
copy to 
clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigConstants.java
index 9fe570f..81585ec
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/LabelDocResponse.java
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigConstants.java
@@ -1,47 +1,40 @@
-/*
- * 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.servicecomb.kie.client.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonAlias;
-
-public class LabelDocResponse {
-
-  @JsonAlias("label_id")
-  private String labelId;
-
-  private Map<String, String> labels = new HashMap<String, String>();
-
-  public String getLabelId() {
-    return labelId;
-  }
-
-  public Map<String, String> getLabels() {
-    return labels;
-  }
-
-  public void setLabelId(String labelId) {
-    this.labelId = labelId;
-  }
-
-  public void setLabels(Map<String, String> labels) {
-    this.labels = labels;
-  }
-}
+/*
+ * 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.servicecomb.config.kie.client.model;
+
+
+public class ConfigConstants {
+
+  public static final String LABEL_ENV = "environment";
+
+  public static final String LABEL_APP = "app";
+
+  public static final String LABEL_SERVICE = "service";
+
+  public static final String LABEL_VERSION = "version";
+
+  public static final String STATUS_ENABLED = "enabled";
+
+  public static final String KEY_PROJECT = "project";
+
+  // ###### kie config center polling configuration############### //
+  public static final String KEY_ENABLELONGPOLLING = "enableLongPolling";
+
+  public static final String KEY_POLLINGWAITSEC = "pollingWaitInSeconds";
+
+}
diff --git 
a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsRequest.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsRequest.java
new file mode 100644
index 0000000..1523334
--- /dev/null
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsRequest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.servicecomb.config.kie.client.model;
+
+public class ConfigurationsRequest {
+  private String environment;
+
+  private String application;
+
+  private String serviceName;
+
+  private String version;
+
+  private String revision;
+
+  public String getEnvironment() {
+    return environment;
+  }
+
+  public ConfigurationsRequest setEnvironment(String environment) {
+    this.environment = environment;
+    return this;
+  }
+
+  public String getApplication() {
+    return application;
+  }
+
+  public ConfigurationsRequest setApplication(String application) {
+    this.application = application;
+    return this;
+  }
+
+  public String getServiceName() {
+    return serviceName;
+  }
+
+  public ConfigurationsRequest setServiceName(String serviceName) {
+    this.serviceName = serviceName;
+    return this;
+  }
+
+  public String getVersion() {
+    return version;
+  }
+
+  public ConfigurationsRequest setVersion(String version) {
+    this.version = version;
+    return this;
+  }
+
+  public String getRevision() {
+    return revision;
+  }
+
+  public ConfigurationsRequest setRevision(String revision) {
+    this.revision = revision;
+    return this;
+  }
+}
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/KVBody.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsResponse.java
old mode 100755
new mode 100644
similarity index 53%
rename from 
clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/KVBody.java
rename to 
clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsResponse.java
index 22ec404..157f2e1
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/KVBody.java
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsResponse.java
@@ -1,57 +1,56 @@
-/*
- * 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.servicecomb.kie.client.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonAlias;
-
-public class KVBody {
-
-  private Map<String, String> labels = new HashMap<String, String>();
-
-  private String value;
-
-  @JsonAlias("value_type")
-  private String valueType;
-
-  public Map<String, String> getLabels() {
-    return labels;
-  }
-
-  public void setLabels(Map<String, String> labels) {
-    this.labels = labels;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public void setValue(String value) {
-    this.value = value;
-  }
-
-  public String getValueType() {
-    return valueType;
-  }
-
-  public void setValueType(String valueType) {
-    this.valueType = valueType;
-  }
-}
+/*
+ * 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.servicecomb.config.kie.client.model;
+
+import java.util.Map;
+
+public class ConfigurationsResponse {
+  private String revision;
+
+  private boolean changed;
+
+  private Map<String, Object> configurations;
+
+  public String getRevision() {
+    return revision;
+  }
+
+  public ConfigurationsResponse setRevision(String revision) {
+    this.revision = revision;
+    return this;
+  }
+
+  public boolean isChanged() {
+    return changed;
+  }
+
+  public ConfigurationsResponse setChanged(boolean changed) {
+    this.changed = changed;
+    return this;
+  }
+
+  public Map<String, Object> getConfigurations() {
+    return configurations;
+  }
+
+  public ConfigurationsResponse setConfigurations(
+      Map<String, Object> configurations) {
+    this.configurations = configurations;
+    return this;
+  }
+}
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/KVDoc.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KVDoc.java
old mode 100755
new mode 100644
similarity index 86%
rename from 
clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/KVDoc.java
rename to 
clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KVDoc.java
index 7cb0ee2..d5d00c3
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/KVDoc.java
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KVDoc.java
@@ -1,119 +1,118 @@
-/*
- * 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.servicecomb.kie.client.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonAlias;
-
-public class KVDoc {
-
-  @JsonAlias("_id")
-  private String id;
-
-  private String check;
-
-  private String domain;
-
-  private String key;
-
-  @JsonAlias("label_id")
-  private String labelId;
-
-  private Map<String, String> labels = new HashMap<String, String>();
-
-  private Integer revision;
-
-  private String value;
-
-  @JsonAlias("value_type")
-  private String valueType;
-
-  public String getId() {
-    return id;
-  }
-
-  public void setId(String id) {
-    this.id = id;
-  }
-
-  public String getKey() {
-    return key;
-  }
-
-  public void setKey(String key) {
-    this.key = key;
-  }
-
-  public String getCheck() {
-    return check;
-  }
-
-  public String getDomain() {
-    return domain;
-  }
-
-  public String getLabelId() {
-    return labelId;
-  }
-
-  public Map<String, String> getLabels() {
-    return labels;
-  }
-
-  public Integer getRevision() {
-    return revision;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public void setCheck(String check) {
-    this.check = check;
-  }
-
-  public void setDomain(String domain) {
-    this.domain = domain;
-  }
-
-  public void setLabelId(String labelId) {
-    this.labelId = labelId;
-  }
-
-  public void setLabels(Map<String, String> labels) {
-    this.labels = labels;
-  }
-
-  public void setRevision(Integer revision) {
-    this.revision = revision;
-  }
-
-  public void setValueType(String valueType) {
-    this.valueType = valueType;
-  }
-
-  public void setValue(String value) {
-    this.value = value;
-  }
-
-  public String getValueType() {
-    return valueType;
-  }
-}
+/*
+ * 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.servicecomb.config.kie.client.model;
+
+import com.fasterxml.jackson.annotation.JsonAlias;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class KVDoc {
+
+  private String id;
+
+  private String check;
+
+  private String domain;
+
+  private String key;
+
+  @JsonAlias("label_id")
+  private String labelId;
+
+  private Map<String, String> labels = new HashMap<String, String>();
+
+  private String value;
+
+  @JsonAlias("value_type")
+  private String valueType;
+
+  private String status;
+
+  public String getStatus() {
+    return status;
+  }
+
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  public String getKey() {
+    return key;
+  }
+
+  public void setKey(String key) {
+    this.key = key;
+  }
+
+  public String getCheck() {
+    return check;
+  }
+
+  public String getDomain() {
+    return domain;
+  }
+
+  public String getLabelId() {
+    return labelId;
+  }
+
+  public Map<String, String> getLabels() {
+    return labels;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public void setCheck(String check) {
+    this.check = check;
+  }
+
+  public void setDomain(String domain) {
+    this.domain = domain;
+  }
+
+  public void setLabelId(String labelId) {
+    this.labelId = labelId;
+  }
+
+  public void setLabels(Map<String, String> labels) {
+    this.labels = labels;
+  }
+
+  public void setValueType(String valueType) {
+    this.valueType = valueType;
+  }
+
+  public void setValue(String value) {
+    this.value = value;
+  }
+
+  public String getValueType() {
+    return valueType;
+  }
+}
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/KVResponse.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KVResponse.java
old mode 100755
new mode 100644
similarity index 85%
rename from 
clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/KVResponse.java
rename to 
clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KVResponse.java
index a72cb1b..e728acb
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/KVResponse.java
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KVResponse.java
@@ -1,43 +1,53 @@
-/*
- * 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.servicecomb.kie.client.model;
-
-import java.util.List;
-
-public class KVResponse {
-
-  private List<KVDoc> data;
-
-  private LabelDocResponse label;
-
-  public List<KVDoc> getData() {
-    return data;
-  }
-
-  public LabelDocResponse getLabel() {
-    return label;
-  }
-
-  public void setData(List<KVDoc> data) {
-    this.data = data;
-  }
-
-  public void setLabel(LabelDocResponse label) {
-    this.label = label;
-  }
-}
+/*
+ * 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.servicecomb.config.kie.client.model;
+
+import java.util.List;
+
+public class KVResponse {
+
+  private List<KVDoc> data;
+
+  private LabelDocResponse label;
+
+  private Integer total;
+
+  public Integer getTotal() {
+    return total;
+  }
+
+  public void setTotal(Integer total) {
+    this.total = total;
+  }
+
+  public List<KVDoc> getData() {
+    return data;
+  }
+
+  public LabelDocResponse getLabel() {
+    return label;
+  }
+
+  public void setData(List<KVDoc> data) {
+    this.data = data;
+  }
+
+  public void setLabel(LabelDocResponse label) {
+    this.label = label;
+  }
+}
diff --git 
a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KieAddressManager.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KieAddressManager.java
new file mode 100644
index 0000000..1b32be6
--- /dev/null
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KieAddressManager.java
@@ -0,0 +1,67 @@
+/*
+ * 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.servicecomb.config.kie.client.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Random;
+
+public class KieAddressManager {
+
+  private final Properties properties;
+
+  private final List<String> addresses;
+
+  private final Map<String, String> configKey;
+
+  private int index;
+
+  public KieAddressManager(Properties properties, List<String> addresses, 
Map<String, String> configKey) {
+    this.properties = properties;
+    this.addresses = new ArrayList<>(addresses.size());
+    this.configKey = configKey;
+    addresses.forEach((address -> this.addresses.add(address)));
+    this.index = new Random().nextInt(addresses.size());
+  }
+
+  public String nextAddress() {
+    synchronized (this) {
+      this.index++;
+      if (this.index >= addresses.size()) {
+        this.index = 0;
+      }
+    }
+    return address();
+  }
+
+  public String address() {
+    synchronized (this) {
+      return addresses.get(index);
+    }
+  }
+
+  public Properties getProperties() {
+    return properties;
+  }
+
+  public Map<String, String> getConfigKey() {
+    return configKey;
+  }
+}
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/LabelDocResponse.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/LabelDocResponse.java
old mode 100755
new mode 100644
similarity index 93%
rename from 
clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/LabelDocResponse.java
rename to 
clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/LabelDocResponse.java
index 9fe570f..6235990
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/model/LabelDocResponse.java
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/LabelDocResponse.java
@@ -1,47 +1,47 @@
-/*
- * 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.servicecomb.kie.client.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonAlias;
-
-public class LabelDocResponse {
-
-  @JsonAlias("label_id")
-  private String labelId;
-
-  private Map<String, String> labels = new HashMap<String, String>();
-
-  public String getLabelId() {
-    return labelId;
-  }
-
-  public Map<String, String> getLabels() {
-    return labels;
-  }
-
-  public void setLabelId(String labelId) {
-    this.labelId = labelId;
-  }
-
-  public void setLabels(Map<String, String> labels) {
-    this.labels = labels;
-  }
-}
+/*
+ * 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.servicecomb.config.kie.client.model;
+
+import com.fasterxml.jackson.annotation.JsonAlias;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class LabelDocResponse {
+
+  @JsonAlias("label_id")
+  private String labelId;
+
+  private Map<String, String> labels = new HashMap<String, String>();
+
+  public String getLabelId() {
+    return labelId;
+  }
+
+  public Map<String, String> getLabels() {
+    return labels;
+  }
+
+  public void setLabelId(String labelId) {
+    this.labelId = labelId;
+  }
+
+  public void setLabels(Map<String, String> labels) {
+    this.labels = labels;
+  }
+}
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpTransportFactory.java
 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ValueType.java
old mode 100755
new mode 100644
similarity index 73%
rename from 
clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpTransportFactory.java
rename to 
clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ValueType.java
index 9d61648..7531afb
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpTransportFactory.java
+++ 
b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ValueType.java
@@ -15,17 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.kie.client.http;
+package org.apache.servicecomb.config.kie.client.model;
 
-public class HttpTransportFactory {
-
-  private static final HttpTransport httpTransport = new HttpTransportImpl();
-
-  private HttpTransportFactory() {
-
-  }
-
-  public static HttpTransport getDefaultHttpTransport() {
-    return httpTransport;
-  }
+public enum ValueType {
+  yml,
+  yaml,
+  string,
+  text,
+  json,
+  properties
 }
diff --git a/clients/kie-client/README.md b/clients/kie-client/README.md
deleted file mode 100644
index f8eed0a..0000000
--- a/clients/kie-client/README.md
+++ /dev/null
@@ -1,88 +0,0 @@
-## ServiceComb-Kie Client for Java
-
-   Sample Java client for ServiceComb-Kie HTTP OPENAPI. If you want more 
information about the ServiceComb-Kie, go 
[here](https://github.com/apache/servicecomb-kie).
-   
-### Build & Install
-   
-   local Build from source:
-   ```
-    maven clean install
-   ```
-   
-   add dependency to maven:
-   ```
-    <dependency>
-        <groupId>org.apache.servicecomb</groupId>
-        <artifactId>kie-client</artifactId>
-    </dependency>
-   ```
-
-
-### Basic Usage
-
-#### Case 1: Setting host and port for connecting server 
-```java
-//setting host= 192.168.88.229, port = 30111 and unset projectName
-KieClient kieClient = new KieClient("192.168.88.299",30111,null);
-
-//unsetting host,port,projectName and use default
-KieClient kieClient = new KieClient();
-```
-
-#### Case 2: Create value of a key
-```java
-KieClient kieClient = new KieClient();
-
-//state a KVBody Object
-KVBody kvBody = new KVBody();
-kvBody.setValue("testValue");
-Map<String, String> labels = new HashMap<>();
-labels.put("app", "111");
-kvBody.setLabels(labels);
-
-//create key-value
-kieClient1.putKeyValue("test",kvBody)  
-```
-
-#### Case 3: Get value of a key
-```java
-KieClient kieClient = new KieClient();
-
-//get key-value by key
-List<KVResponse> kvResponses = kieClient.getValueOfKey("test");
-```
-
-#### Case 4: Search key-value by lables
-```java
-KieClient kieClient = new KieClient();
-
-//state a Map<String,String> as labels
-Map<String, String> labels = new HashMap<>();
-labels.put("app", "111");
-
-//get key-value by labels
-List<KVResponse> searchKVResponses = kieClient.searchKeyValueByLabels(labels);
-```
-
-#### Case 5: Delete key-value
-```java
-KieClient kieClient = new KieClient(kieRawClient);
-
-//get key-value by key
-List<KVResponse> kvResponses = kieClient.getValueOfKey("test");
-
-//delete all key-value of key
-for(KVResponse kvResponse : kvResponses){
-  for (KVDoc kvDoc : kvResponse.getData()){
-    kieClient.deleteKeyValue(kvDoc);
-  }
-}
-```
-
-### More development
-
-- Support for SSL authentication
-- Implement dynamic config
-
-### Contact
-Bugs/Feature : 
[issues](https://github.com/apache/servicecomb-java-chassis/issues)
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/KieClient.java
 
b/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/KieClient.java
deleted file mode 100755
index 4c846e2..0000000
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/KieClient.java
+++ /dev/null
@@ -1,160 +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.servicecomb.kie.client;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.http.HttpStatus;
-import org.apache.servicecomb.kie.client.http.HttpResponse;
-import org.apache.servicecomb.kie.client.model.KVBody;
-import org.apache.servicecomb.kie.client.model.KVDoc;
-import org.apache.servicecomb.kie.client.model.KVResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * Created by   on 2019/10/28.
- */
-public class KieClient {
-
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(KieClient.class);
-
-  private KieRawClient httpClient;
-
-  public KieClient() {
-    this(new KieRawClient());
-  }
-
-  /**
-   * Customized host,port,projectName and if any one parameter is null, it 
will be defaults
-   *
-   * @param host
-   * @param port
-   * @param projectName
-   */
-  public KieClient(String host, int port, String projectName) {
-    this.httpClient = new 
KieRawClient.Builder().setHost(host).setPort(port).setProjectName(projectName).build();
-  }
-
-  public KieClient(KieRawClient serviceCenterRawClient) {
-    this.httpClient = serviceCenterRawClient;
-  }
-
-  /**
-   * Create value of a key
-   *
-   * @param key
-   * @param kvBody
-   * @return key-value json string; when some error happens, return null
-   */
-  public String putKeyValue(String key, KVBody kvBody) {
-    try {
-      ObjectMapper mapper = new ObjectMapper();
-      HttpResponse response = httpClient.putHttpRequest("/kie/kv/" + key, 
null, mapper.writeValueAsString(kvBody));
-      if (response.getStatusCode() == HttpStatus.SC_OK) {
-        return response.getContent();
-      } else {
-        LOGGER.error("create keyValue fails, responseStatusCode={}, 
responseMessage={}, responseContent{}",
-            response.getStatusCode(), response.getMessage(), 
response.getContent());
-      }
-    } catch (IOException e) {
-      LOGGER.error("create keyValue fails", e);
-    }
-    return null;
-  }
-
-  /**
-   * Get value of a key
-   *
-   * @param key
-   * @return List<KVResponse>; when some error happens, return null
-   */
-  public List<KVResponse> getValueOfKey(String key) {
-    try {
-      HttpResponse response = httpClient.getHttpRequest("/kie/kv/" + key, 
null, null);
-      if (response.getStatusCode() == HttpStatus.SC_OK) {
-        ObjectMapper mapper = new ObjectMapper();
-        return mapper.readValue(response.getContent(), new 
TypeReference<List<KVResponse>>() {
-        });
-      } else {
-        LOGGER.error("get value of key fails, responseStatusCode={}, 
responseMessage={}, responseContent{}",
-            response.getStatusCode(), response.getMessage(), 
response.getContent());
-      }
-    } catch (IOException e) {
-      LOGGER.error("get value of key fails", e);
-    }
-    return null;
-  }
-
-  /**
-   * SearchByLabels get value by lables
-   *
-   * @param labels
-   * @return List<KVResponse>; when some error happens, return null
-   */
-  public List<KVResponse> searchKeyValueByLabels(Map<String, String> labels) {
-    try {
-      StringBuilder stringBuilder = new StringBuilder();
-      for (Entry<String, String> entry : labels.entrySet()) {
-        stringBuilder.append(entry.getKey());
-        stringBuilder.append(":");
-        stringBuilder.append(entry.getValue());
-        stringBuilder.append("+");
-      }
-      stringBuilder.deleteCharAt(stringBuilder.length() - 1);
-      HttpResponse response = httpClient.getHttpRequest("/kie/kv?q=" + 
stringBuilder.toString(), null, null);
-      if (response.getStatusCode() == HttpStatus.SC_OK) {
-        ObjectMapper mapper = new ObjectMapper();
-        return mapper.readValue(response.getContent(), new 
TypeReference<List<KVResponse>>() {
-        });
-      } else {
-        LOGGER.error("search keyValue by labels fails, responseStatusCode={}, 
responseMessage={}, responseContent{}",
-            response.getStatusCode(), response.getMessage(), 
response.getContent());
-      }
-    } catch (IOException e) {
-      LOGGER.error("search keyValue by labels fails", e);
-    }
-    return null;
-  }
-
-  /**
-   * Delete remove kv
-   *
-   * @param kvDoc
-   * @return void
-   */
-  public void deleteKeyValue(KVDoc kvDoc) {
-    try {
-      HttpResponse response = httpClient.deleteHttpRequest("/kie/kv/?kvID=" + 
kvDoc.getId(), null, null);
-      if (response.getStatusCode() == HttpStatus.SC_NO_CONTENT) {
-        LOGGER.info("Delete keyValue success");
-      } else {
-        LOGGER.error("delete keyValue fails, responseStatusCode={}, 
responseMessage={}, responseContent{}",
-            response.getStatusCode(), response.getMessage(), 
response.getContent());
-      }
-    } catch (IOException e) {
-      LOGGER.error("delete keyValue fails", e);
-    }
-  }
-}
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/KieRawClient.java
 
b/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/KieRawClient.java
deleted file mode 100755
index 4dc64f0..0000000
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/KieRawClient.java
+++ /dev/null
@@ -1,188 +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.servicecomb.kie.client;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.servicecomb.kie.client.http.HttpRequest;
-import org.apache.servicecomb.kie.client.http.HttpResponse;
-import org.apache.servicecomb.kie.client.http.HttpTransport;
-import org.apache.servicecomb.kie.client.http.HttpTransportFactory;
-
-/**
- * Created by   on 2019/10/24.
- */
-public class KieRawClient {
-
-  private static final String DEFAULT_HOST = "localhost";
-
-  private static final int DEFAULT_PORT = 30110;
-
-  private static final String PROJECT_NAME = "default";
-
-  private static final String V4_PREFIX = "v1";
-
-  private String basePath;
-
-  private String host;
-
-  private int port;
-
-  private String projectName;
-
-  private HttpTransport httpTransport;
-
-  public KieRawClient() {
-    this(DEFAULT_HOST, DEFAULT_PORT, PROJECT_NAME, 
HttpTransportFactory.getDefaultHttpTransport());
-  }
-
-  private KieRawClient(String host, int port, String projectName, 
HttpTransport httpTransport) {
-    this.host = host;
-    this.port = port;
-    this.projectName = projectName;
-    this.httpTransport = httpTransport;
-
-    // check that host has scheme or not
-    String hostLowercase = host.toLowerCase();
-    if (!hostLowercase.startsWith("https://";) && 
!hostLowercase.startsWith("http://";)) {
-      // no protocol in host, use default 'http'
-      host = "http://"; + host;
-    }
-
-    this.basePath = host + ":" + port + "/" + V4_PREFIX + "/" + projectName;
-  }
-
-  public HttpResponse getHttpRequest(String url, Map<String, String> headers, 
String content) throws IOException {
-
-    if (headers == null) {
-      headers = new HashMap<String, String>();
-    }
-
-    HttpRequest httpRequest = new HttpRequest(basePath + url, headers, 
content);
-
-    return httpTransport.get(httpRequest);
-  }
-
-  public HttpResponse postHttpRequest(String url, Map<String, String> headers, 
String content) throws IOException {
-
-    if (headers == null) {
-      headers = new HashMap<String, String>();
-    }
-
-    HttpRequest httpRequest = new HttpRequest(basePath + url, headers, 
content);
-
-    return httpTransport.post(httpRequest);
-  }
-
-  public HttpResponse putHttpRequest(String url, Map<String, String> headers, 
String content) throws IOException {
-
-    if (headers == null) {
-      headers = new HashMap<String, String>();
-    }
-
-    HttpRequest httpRequest = new HttpRequest(basePath + url, headers, 
content);
-
-    return httpTransport.put(httpRequest);
-  }
-
-  public HttpResponse deleteHttpRequest(String url, Map<String, String> 
headers, String content) throws IOException {
-
-    if (headers == null) {
-      headers = new HashMap<String, String>();
-    }
-
-    HttpRequest httpRequest = new HttpRequest(basePath + url, headers, 
content);
-
-    return httpTransport.delete(httpRequest);
-  }
-
-  public HttpTransport getHttpTransport() {
-    return httpTransport;
-  }
-
-  public void setHttpTransport(HttpTransport httpTransport) {
-    this.httpTransport = httpTransport;
-  }
-
-  public static class Builder {
-    private String host;
-
-    private int port;
-
-    private String projectName;
-
-    private HttpTransport httpTransport;
-
-    public Builder() {
-      this.host = DEFAULT_HOST;
-      this.port = DEFAULT_PORT;
-      this.projectName = PROJECT_NAME;
-    }
-
-    public String getProjectName() {
-      return projectName;
-    }
-
-    public Builder setProjectName(String projectName) {
-      if (projectName == null) {
-        projectName = PROJECT_NAME;
-      }
-      this.projectName = projectName;
-      return this;
-    }
-
-    public int getPort() {
-      return port;
-    }
-
-    public Builder setPort(int port) {
-      if (port <= 0) {
-        port = DEFAULT_PORT;
-      }
-      this.port = port;
-      return this;
-    }
-
-    public String getHost() {
-      return host;
-    }
-
-    public Builder setHost(String host) {
-      if (host == null) {
-        host = DEFAULT_HOST;
-      }
-      this.host = host;
-      return this;
-    }
-
-    public HttpTransport getHttpTransport() {
-      return httpTransport;
-    }
-
-    public Builder setHttpTransport(HttpTransport httpTransport) {
-      this.httpTransport = httpTransport;
-      return this;
-    }
-
-    public KieRawClient build() {
-      return new KieRawClient(host, port, projectName, httpTransport);
-    }
-  }
-}
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpResponse.java
 
b/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpResponse.java
deleted file mode 100755
index f2c0cd0..0000000
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpResponse.java
+++ /dev/null
@@ -1,61 +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.servicecomb.kie.client.http;
-
-public class HttpResponse {
-
-  private int statusCode;
-
-  private String message;
-
-  private String content;
-
-  public HttpResponse() {
-
-  }
-
-  HttpResponse(int statusCode, String message, String content) {
-    this.statusCode = statusCode;
-    this.content = content;
-    this.message = message;
-  }
-
-  public int getStatusCode() {
-    return statusCode;
-  }
-
-  public void setStatusCode(int statusCode) {
-    this.statusCode = statusCode;
-  }
-
-  public String getMessage() {
-    return message;
-  }
-
-  public void setMessage(String message) {
-    this.message = message;
-  }
-
-  public String getContent() {
-    return content;
-  }
-
-  public void setContent(String content) {
-    this.content = content;
-  }
-}
diff --git 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpTransportImpl.java
 
b/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpTransportImpl.java
deleted file mode 100755
index e210812..0000000
--- 
a/clients/kie-client/src/main/java/org/apache/servicecomb/kie/client/http/HttpTransportImpl.java
+++ /dev/null
@@ -1,120 +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.servicecomb.kie.client.http;
-
-import java.io.IOException;
-
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.util.EntityUtils;
-
-/**
- * Created by   on 2019/10/16.
- */
-public class HttpTransportImpl implements HttpTransport {
-
-  private static final String HEADER_CONTENT_TYPE = "Content-Type";
-
-  private static final String HEADER_USER_AGENT = "User-Agent";
-
-  private static final String HEADER_TENANT_NAME = "x-domain-name";
-
-  protected HttpClient httpClient;
-
-  public HttpClient getHttpClient() {
-    return httpClient;
-  }
-
-  public void setHttpClient(HttpClient httpClient) {
-    this.httpClient = httpClient;
-  }
-
-  public HttpTransportImpl() {
-    httpClient = HttpClients.createDefault();
-  }
-
-  @Override
-  public HttpResponse get(HttpRequest request) throws IOException {
-
-    HttpGet httpGet = new HttpGet(request.getUrl());
-
-    return doRequest(httpGet);
-  }
-
-  @Override
-  public HttpResponse post(HttpRequest request) throws IOException {
-
-    HttpPost httpPost = new HttpPost(request.getUrl());
-
-    if (request.getContent() != null) {
-      httpPost.setEntity(new StringEntity(request.getContent(), "UTF-8"));
-    }
-    return doRequest(httpPost);
-  }
-
-  @Override
-  public HttpResponse put(HttpRequest request) throws IOException {
-
-    HttpPut httpPut = new HttpPut(request.getUrl());
-
-    if (request.getContent() != null) {
-      httpPut.setEntity(new StringEntity(request.getContent(), "UTF-8"));
-    }
-    return doRequest(httpPut);
-  }
-
-  @Override
-  public HttpResponse delete(HttpRequest request) throws IOException {
-
-    HttpDelete httpDelete = new HttpDelete(request.getUrl());
-
-    return doRequest(httpDelete);
-  }
-
-  /**
-   * handle httpRequest
-   *
-   * @param httpRequest
-   * @return
-   * @throws IOException
-   */
-  private HttpResponse doRequest(HttpUriRequest httpRequest) throws 
IOException {
-    //add header
-    httpRequest.addHeader(HEADER_CONTENT_TYPE, "application/json");
-    httpRequest.addHeader(HEADER_USER_AGENT, "kie-client/1.0.0");
-    httpRequest.addHeader(HEADER_TENANT_NAME, "default");
-
-    //get Http response
-    org.apache.http.HttpResponse response = httpClient.execute(httpRequest);
-
-    int statusCode = response.getStatusLine().getStatusCode();
-    String messgae = response.getStatusLine().getReasonPhrase();
-    String context = null;
-    if (response.getEntity() != null) {
-      context = EntityUtils.toString(response.getEntity(), "UTF-8");
-    }
-
-    return new HttpResponse(statusCode, messgae, context);
-  }
-}
\ No newline at end of file
diff --git 
a/clients/kie-client/src/test/java/org/apache/servicecomb/kie/client/HttpTransportTest.java
 
b/clients/kie-client/src/test/java/org/apache/servicecomb/kie/client/HttpTransportTest.java
deleted file mode 100644
index 175c996..0000000
--- 
a/clients/kie-client/src/test/java/org/apache/servicecomb/kie/client/HttpTransportTest.java
+++ /dev/null
@@ -1,64 +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.servicecomb.kie.client;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-
-import org.apache.http.HttpVersion;
-import org.apache.http.StatusLine;
-import org.apache.http.client.HttpClient;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.servicecomb.kie.client.http.HttpRequest;
-import org.apache.servicecomb.kie.client.http.HttpResponse;
-import org.apache.servicecomb.kie.client.http.HttpTransportImpl;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class HttpTransportTest {
-
-  @Test
-  public void TestHttpTransport() throws IOException {
-    HttpClient httpClient = mock(HttpClient.class);
-
-    org.apache.http.HttpResponse httpResponse = 
mock(org.apache.http.HttpResponse.class);
-    StatusLine statusLine = mock(StatusLine.class);
-    when(statusLine.getStatusCode()).thenReturn(200);
-    when(statusLine.getProtocolVersion()).thenReturn(HttpVersion.HTTP_1_1);
-    when(statusLine.getReasonPhrase()).thenReturn("OK");
-
-    when(httpResponse.getStatusLine()).thenReturn(statusLine);
-    when(httpResponse.getEntity()).thenReturn(new StringEntity("Test", 
ContentType.APPLICATION_JSON));
-
-    HttpTransportImpl httpTransport = new HttpTransportImpl();
-    httpTransport.setHttpClient(httpClient);
-    when(httpClient.execute(Mockito.any())).thenReturn(httpResponse);
-
-    HttpRequest httpRequest = new HttpRequest("111", null, null);
-    HttpResponse actualResponse = httpTransport.get(httpRequest);
-
-    Assert.assertNotNull(actualResponse);
-    Assert.assertEquals(200, actualResponse.getStatusCode());
-    Assert.assertEquals("OK", actualResponse.getMessage());
-    Assert.assertEquals("Test", actualResponse.getContent());
-  }
-}
diff --git 
a/clients/kie-client/src/test/java/org/apache/servicecomb/kie/client/KieClientTest.java
 
b/clients/kie-client/src/test/java/org/apache/servicecomb/kie/client/KieClientTest.java
deleted file mode 100755
index 965f218..0000000
--- 
a/clients/kie-client/src/test/java/org/apache/servicecomb/kie/client/KieClientTest.java
+++ /dev/null
@@ -1,146 +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.servicecomb.kie.client;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.servicecomb.kie.client.http.HttpResponse;
-import org.apache.servicecomb.kie.client.model.KVBody;
-import org.apache.servicecomb.kie.client.model.KVDoc;
-import org.apache.servicecomb.kie.client.model.KVResponse;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * Created by   on 2019/10/24.
- */
-public class KieClientTest {
-
-  @Test
-  public void putKeyValue() throws IOException {
-    KieRawClient kieRawClient = Mockito.mock(KieRawClient.class);
-
-    KVBody kvBody = new KVBody();
-    kvBody.setValue("test");
-    kvBody.setValueType("string");
-    Map<String, String> labels = new HashMap<>();
-    labels.put("app1", "111");
-    kvBody.setLabels(labels);
-
-    HttpResponse httpResponse = new HttpResponse();
-    httpResponse.setStatusCode(200);
-    httpResponse.setMessage("OK");
-    String responseContext = "{\n" +
-        " \"_id\": \"5db0213bb927bafaf707e06a\",\n" +
-        " \"label_id\": \"5db0039bb927bafaf707e037\",\n" +
-        " \"key\": \"testKey\",\n" +
-        " \"value\": \"testValue\",\n" +
-        " \"value_type\": \"string\",\n" +
-        " \"labels\": {\n" +
-        "  \"app1\": \"111\"\n" +
-        " },\n" +
-        " \"domain\": \"default\",\n" +
-        " \"revision\": 10\n" +
-        "}";
-    httpResponse.setContent(responseContext);
-    ObjectMapper mapper = new ObjectMapper();
-
-    Mockito.when(kieRawClient.putHttpRequest("/kie/kv/test1", null, 
mapper.writeValueAsString(kvBody)))
-        .thenReturn(httpResponse);
-
-    KieClient kieClient = new KieClient(kieRawClient);
-    String kvResponses = kieClient.putKeyValue("test1", kvBody);
-
-    Assert.assertNotNull(kvResponses);
-//    Assert.assertEquals("testKey", 
mapper.writeValueAsString(kvResponses).getString("key"));
-//    Assert.assertEquals("testValue", 
JSONObject.parseObject(kvResponses).getString("value"));
-  }
-
-  @Test
-  public void getKeyValue() throws IOException {
-    KieRawClient kieRawClient = Mockito.mock(KieRawClient.class);
-
-    HttpResponse httpResponse = new HttpResponse();
-    httpResponse.setStatusCode(200);
-    httpResponse.setMessage("OK");
-    String responseContext = "[\n" +
-        "    {\n" +
-        "        \"label\": {\n" +
-        "            \"label_id\": \"5db0039bb927bafaf707e037\",\n" +
-        "            \"labels\": {\"app1\": \"111\"\n" +
-        "            }\n" +
-        "        },\n" +
-        "        \"data\": [\n" +
-        "            {\n" +
-        "                \"_id\": \"5db0127db927bafaf707e068\",\n" +
-        "                \"key\": \"111\",\n" +
-        "                \"value\": \"test\",\n" +
-        "                \"value_type\": \"string\"\n" +
-        "            }\n" +
-        "        ]\n" +
-        "    }\n" +
-        "]";
-    httpResponse.setContent(responseContext);
-
-    Mockito.when(kieRawClient.getHttpRequest("/kie/kv/test1", null, 
null)).thenReturn(httpResponse);
-    Mockito.when(kieRawClient.getHttpRequest("/kie/kv?q=app1:111", null, 
null)).thenReturn(httpResponse);
-
-    KieClient kieClient = new KieClient(kieRawClient);
-    List<KVResponse> kvResponses = kieClient.getValueOfKey("test1");
-
-    Map<String, String> map = new HashMap<>();
-    map.put("app1", "111");
-    List<KVResponse> searchKVResponses = kieClient.searchKeyValueByLabels(map);
-
-    Assert.assertNotNull(kvResponses);
-    Assert.assertEquals("111", kvResponses.get(0).getData().get(0).getKey());
-    Assert.assertEquals("test", 
kvResponses.get(0).getData().get(0).getValue());
-    Assert.assertEquals("{app1=111}", 
kvResponses.get(0).getLabel().getLabels().toString());
-
-    Assert.assertNotNull(searchKVResponses);
-    Assert.assertEquals("111", 
searchKVResponses.get(0).getData().get(0).getKey());
-    Assert.assertEquals("test", 
searchKVResponses.get(0).getData().get(0).getValue());
-    Assert.assertEquals("{app1=111}", 
searchKVResponses.get(0).getLabel().getLabels().toString());
-  }
-
-  @Test
-  public void deleteKeyValue() throws IOException {
-    KieRawClient kieRawClient = Mockito.mock(KieRawClient.class);
-
-    KVDoc kvDoc = new KVDoc();
-    kvDoc.setId("111");
-    kvDoc.setKey("test");
-    kvDoc.setValue("testValue");
-
-    HttpResponse httpResponse = new HttpResponse();
-    httpResponse.setStatusCode(204);
-    httpResponse.setMessage("OK");
-
-    Mockito.when(kieRawClient.deleteHttpRequest("/kie/kv/?kvID=" + 
kvDoc.getId(), null, null))
-        .thenReturn(httpResponse);
-
-    KieClient kieClient = new KieClient(kieRawClient);
-    kieClient.deleteKeyValue(kvDoc);
-  }
-}
diff --git 
a/clients/kie-client/src/test/java/org/apache/servicecomb/kie/client/KieRawClientTest.java
 
b/clients/kie-client/src/test/java/org/apache/servicecomb/kie/client/KieRawClientTest.java
deleted file mode 100755
index 3b70e29..0000000
--- 
a/clients/kie-client/src/test/java/org/apache/servicecomb/kie/client/KieRawClientTest.java
+++ /dev/null
@@ -1,75 +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.servicecomb.kie.client;
-
-import java.io.IOException;
-
-import org.apache.servicecomb.kie.client.http.HttpRequest;
-import org.apache.servicecomb.kie.client.http.HttpResponse;
-import org.apache.servicecomb.kie.client.http.HttpTransport;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-/**
- * Created by   on 2019/10/24.
- */
-public class KieRawClientTest {
-
-  private static final String DEFAULT_HOST = "192.168.88.229";
-
-  private static final int DEFAULT_PORT = 30110;
-
-  private static final String DEFAULT_DOMAIN = "testProject";
-
-  @Test
-  public void TestDefaultUrl() throws IOException {
-
-    HttpTransport httpTransport = Mockito.mock(HttpTransport.class);
-
-    KieRawClient client = new KieRawClient.Builder()
-        .setHttpTransport(httpTransport)
-        .setHost(DEFAULT_HOST)
-        .setPort(DEFAULT_PORT)
-        .setProjectName(DEFAULT_DOMAIN)
-        .build();
-
-    HttpResponse httpResponse = new HttpResponse();
-    httpResponse.setStatusCode(200);
-    httpResponse.setContent("ok");
-
-    Mockito.when(httpTransport.get((HttpRequest) 
Mockito.any())).thenReturn(httpResponse);
-    Mockito.when(httpTransport.post((HttpRequest) 
Mockito.any())).thenReturn(httpResponse);
-    Mockito.when(httpTransport.put((HttpRequest) 
Mockito.any())).thenReturn(httpResponse);
-    Mockito.when(httpTransport.delete((HttpRequest) 
Mockito.any())).thenReturn(httpResponse);
-
-    HttpResponse actualGetResponse = client.getHttpRequest(null, null, null);
-    HttpResponse actualPostResponse = client.postHttpRequest(null, null, null);
-    HttpResponse actualPutResponse = client.putHttpRequest(null, null, null);
-    HttpResponse actualDeleteResponse = client.putHttpRequest(null, null, 
null);
-
-    Assert.assertNotNull(actualGetResponse);
-    Assert.assertEquals("ok", actualGetResponse.getContent());
-    Assert.assertNotNull(actualPostResponse);
-    Assert.assertEquals("ok", actualPostResponse.getContent());
-    Assert.assertNotNull(actualPutResponse);
-    Assert.assertEquals("ok", actualPutResponse.getContent());
-    Assert.assertNotNull(actualDeleteResponse);
-    Assert.assertEquals("ok", actualDeleteResponse.getContent());
-  }
-}
diff --git a/clients/pom.xml b/clients/pom.xml
index 9580fea..d05cff4 100644
--- a/clients/pom.xml
+++ b/clients/pom.xml
@@ -33,7 +33,7 @@
   <packaging>pom</packaging>
   <modules>
     <module>http-client-common</module>
-    <module>kie-client</module>
+    <module>config-kie-client</module>
     <module>service-center-client</module>
     <module>config-center-client</module>
   </modules>

Reply via email to