You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/08/10 02:20:14 UTC

[incubator-servicecomb-java-chassis] branch master updated (257d610 -> a30e796)

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

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


    from 257d610  [SCB-787]fix ping time gap bug and add configuration to time interval
     new 5c6216f  [SCB-793] SCBEngine output log after ready, that makes easier to check if a microservice instance is ready by read log.
     new 7839fcf  [SCB-793] check if deploy completed by read boot log.
     new 1c5d87b  [SCB-793] support deploy serviceCenter: 1.reuse existing instance 2.deploy from environment "serviceCenterHome" 3.deploy from docker
     new 3893428  [SCB-793] run it-consumer during travis CI
     new 6ff2f4d  [SCB-793] make class-path in manifest.mf standard
     new a30e796  [SCB-793] make demo output less log

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:
 .../org/apache/servicecomb/core/SCBEngine.java     |  1 +
 .../demo/signature/ClientSignature.java            |  2 +-
 .../demo/signature/ServerSignature.java            |  2 +-
 .../it-common/src/main/resources/logback.xml       |  2 +-
 .../org/apache/servicecomb/it/ConsumerMain.java    |  6 +-
 .../servicecomb/it/deploy/DeployDefinition.java    | 20 +++++
 .../org/apache/servicecomb/it/deploy/Deploys.java  | 13 ++-
 .../servicecomb/it/deploy/MicroserviceDeploy.java  | 13 ++-
 .../apache/servicecomb/it/deploy/NormalDeploy.java | 31 +++++--
 .../servicecomb/it/deploy/ServiceCenterDeploy.java | 96 ++++++++++++++++++++++
 .../servicecomb/it/deploy/SubProcessLogger.java    | 40 ++++++++-
 .../java/org/apache/servicecomb/it/TestMain.java   | 10 ++-
 integration-tests/pom.xml                          |  2 +-
 13 files changed, 212 insertions(+), 26 deletions(-)
 create mode 100644 integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/ServiceCenterDeploy.java


[incubator-servicecomb-java-chassis] 02/06: [SCB-793] check if deploy completed by read boot log.

Posted by li...@apache.org.
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/incubator-servicecomb-java-chassis.git

commit 7839fcfa7d27a9cfbe815c5de625aa69aca19229
Author: wujimin <wu...@huawei.com>
AuthorDate: Wed Aug 8 22:01:16 2018 +0800

    [SCB-793] check if deploy completed by read boot log.
---
 .../it-common/src/main/resources/logback.xml       |  2 +-
 .../servicecomb/it/deploy/DeployDefinition.java    | 10 ++++++
 .../servicecomb/it/deploy/MicroserviceDeploy.java  | 13 ++++---
 .../apache/servicecomb/it/deploy/NormalDeploy.java | 24 ++++++++-----
 .../servicecomb/it/deploy/SubProcessLogger.java    | 40 +++++++++++++++++++++-
 5 files changed, 75 insertions(+), 14 deletions(-)

diff --git a/integration-tests/it-common/src/main/resources/logback.xml b/integration-tests/it-common/src/main/resources/logback.xml
index dfdfa92..d753514 100644
--- a/integration-tests/it-common/src/main/resources/logback.xml
+++ b/integration-tests/it-common/src/main/resources/logback.xml
@@ -23,7 +23,7 @@
       <pattern>%d [%level] [%thread] - %msg (%F:%L\)%n</pattern>
     </encoder>
   </appender>
-  <root level="WARN">
+  <root level="INFO">
     <appender-ref ref="STDOUT"/>
   </root>
 </configuration>
\ No newline at end of file
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/DeployDefinition.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/DeployDefinition.java
index dfdc158..f685e47 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/DeployDefinition.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/DeployDefinition.java
@@ -23,6 +23,8 @@ public class DeployDefinition {
 
   protected String displayName;
 
+  protected String startCompleteLog;
+
   /**
    * <pre>
    * edge as the example:
@@ -57,6 +59,14 @@ public class DeployDefinition {
     this.displayName = displayName;
   }
 
+  public String getStartCompleteLog() {
+    return startCompleteLog;
+  }
+
+  public void setStartCompleteLog(String startCompleteLog) {
+    this.startCompleteLog = startCompleteLog;
+  }
+
   public String getCmd() {
     return cmd;
   }
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/MicroserviceDeploy.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/MicroserviceDeploy.java
index 0276882..2892c51 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/MicroserviceDeploy.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/MicroserviceDeploy.java
@@ -16,6 +16,7 @@
  */
 package org.apache.servicecomb.it.deploy;
 
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.servicecomb.it.ITUtils;
 import org.apache.servicecomb.serviceregistry.RegistryUtils;
 import org.apache.servicecomb.serviceregistry.consumer.MicroserviceVersionRule;
@@ -30,11 +31,8 @@ public class MicroserviceDeploy extends NormalDeploy {
   public MicroserviceDeploy(DeployDefinition deployDefinition) {
     super(deployDefinition);
     this.microserviceDeployDefinition = (MicroserviceDeployDefinition) deployDefinition;
-  }
 
-  @Override
-  public void deploy() throws Throwable {
-    super.deploy();
+    this.microserviceDeployDefinition.setStartCompleteLog("ServiceComb is ready.");
   }
 
   @Override
@@ -42,6 +40,12 @@ public class MicroserviceDeploy extends NormalDeploy {
     return new String[] {"java", "-jar", deployDefinition.getCmd()};
   }
 
+  @Override
+  protected String[] addArgs(String[] cmds) {
+    return ArrayUtils.addAll(super.addArgs(cmds),
+        "-DselfController=" + RegistryUtils.getMicroserviceInstance().getInstanceId());
+  }
+
   public void ensureReady() throws Throwable {
     MicroserviceVersionRule microserviceVersionRule = RegistryUtils.getServiceRegistry().getAppManager()
         .getOrCreateMicroserviceVersionRule(microserviceDeployDefinition.getAppId(),
@@ -53,6 +57,7 @@ public class MicroserviceDeploy extends NormalDeploy {
     }
 
     deploy();
+    waitStartComplete();
     ITUtils.waitMicroserviceReady(microserviceDeployDefinition.getAppId(),
         microserviceDeployDefinition.getMicroserviceName(),
         microserviceDeployDefinition.getVersion(),
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java
index f750f1e..146ea5e 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java
@@ -23,7 +23,6 @@ import java.io.OutputStreamWriter;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.servicecomb.foundation.common.utils.JsonUtils;
-import org.apache.servicecomb.serviceregistry.RegistryUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,13 +43,17 @@ public class NormalDeploy {
 
   public void deploy() throws Throwable {
     String[] cmds = createCmds();
-    cmds = ArrayUtils.addAll(cmds, deployDefinition.getArgs());
-    cmds = ArrayUtils.addAll(cmds,
-        "-DselfController=" + RegistryUtils.getMicroserviceInstance().getInstanceId());
+    cmds = addArgs(cmds);
 
     subProcess = createProcessBuilder(cmds).start();
     subProcessCommandWriter = new BufferedWriter(new OutputStreamWriter(subProcess.getOutputStream()));
-    subProcessLogger = new SubProcessLogger(deployDefinition.getDisplayName(), subProcess.getInputStream());
+    subProcessLogger = new SubProcessLogger(deployDefinition.getDisplayName(), subProcess.getInputStream(),
+        deployDefinition.getStartCompleteLog());
+  }
+
+  protected String[] addArgs(String[] cmds) {
+    cmds = ArrayUtils.addAll(cmds, deployDefinition.getArgs());
+    return cmds;
   }
 
   protected String[] createCmds() {
@@ -61,6 +64,10 @@ public class NormalDeploy {
     return new ProcessBuilder(cmds).redirectErrorStream(true);
   }
 
+  public void waitStartComplete() {
+    subProcessLogger.waitStartComplete();
+  }
+
   public void sendCommand(Object command) {
     String strCmd = null;
     try {
@@ -82,7 +89,7 @@ public class NormalDeploy {
 
   public void waitStop() {
     if (subProcess == null) {
-      LOGGER.info("Ignore, already stop, displayName={}.", deployDefinition.getDisplayName());
+      LOGGER.info("Ignore, already stop or reusing exist instance, displayName={}.", deployDefinition.getDisplayName());
       return;
     }
 
@@ -98,17 +105,18 @@ public class NormalDeploy {
     subProcess = null;
     afterStop();
 
-    LOGGER.info("finished stop {}.", deployDefinition.getDisplayName());
+    LOGGER.info("stop complete, displayName={}.", deployDefinition.getDisplayName());
   }
 
   public void stop() {
     if (subProcess == null) {
-      LOGGER.info("Ignore, already stop, displayName={}.", deployDefinition.getDisplayName());
+      LOGGER.info("Ignore, already stop or reusing exist instance, displayName={}.", deployDefinition.getDisplayName());
       return;
     }
 
     subProcess.destroy();
     subProcess = null;
     afterStop();
+    LOGGER.info("stop complete, displayName={}.", deployDefinition.getDisplayName());
   }
 }
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/SubProcessLogger.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/SubProcessLogger.java
index 0189eef..86d7f69 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/SubProcessLogger.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/SubProcessLogger.java
@@ -22,7 +22,9 @@ import java.io.Closeable;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.util.concurrent.TimeUnit;
 
+import org.apache.servicecomb.it.ITUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,8 +37,13 @@ public class SubProcessLogger implements Closeable {
 
   private Thread thread;
 
-  public SubProcessLogger(String displayName, InputStream inputStream) {
+  private String startCompleteLog;
+
+  private volatile boolean startCompleted;
+
+  public SubProcessLogger(String displayName, InputStream inputStream, String startCompleteLog) {
     this.displayName = displayName;
+    this.startCompleteLog = startCompleteLog;
 
     BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
     this.reader = new BufferedReader(new InputStreamReader(bufferedInputStream));
@@ -58,6 +65,37 @@ public class SubProcessLogger implements Closeable {
     while ((line = reader.readLine()) != null) {
       System.out.print(String.format("[%s] ", displayName));
       System.out.println(line);
+
+      checkStartComplete(line);
+    }
+  }
+
+  private void checkStartComplete(String line) {
+    if (startCompleted || startCompleteLog == null) {
+      return;
+    }
+
+    startCompleted = line.contains(startCompleteLog);
+  }
+
+  public boolean isStartCompleted() {
+    return startCompleted;
+  }
+
+  public void waitStartComplete() {
+    if (startCompleteLog == null) {
+      throw new IllegalStateException(
+          String.format("[%s] not set startCompleteLog, can not wait start complete.", displayName));
+    }
+
+    LOGGER.info("waiting {} start.", displayName);
+    for (; ; ) {
+      if (startCompleted) {
+        LOGGER.info("{} start completed.", displayName);
+        return;
+      }
+
+      ITUtils.forceWait(TimeUnit.MILLISECONDS, 500);
     }
   }
 


[incubator-servicecomb-java-chassis] 06/06: [SCB-793] make demo output less log

Posted by li...@apache.org.
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/incubator-servicecomb-java-chassis.git

commit a30e796134ffbbed278365237d32775fa6c9eef5
Author: wujimin <wu...@huawei.com>
AuthorDate: Thu Aug 9 12:55:48 2018 +0800

    [SCB-793] make demo output less log
---
 .../java/org/apache/servicecomb/demo/signature/ClientSignature.java     | 2 +-
 .../java/org/apache/servicecomb/demo/signature/ServerSignature.java     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/demo/demo-signature/src/main/java/org/apache/servicecomb/demo/signature/ClientSignature.java b/demo/demo-signature/src/main/java/org/apache/servicecomb/demo/signature/ClientSignature.java
index 6acd464..aa715d2 100644
--- a/demo/demo-signature/src/main/java/org/apache/servicecomb/demo/signature/ClientSignature.java
+++ b/demo/demo-signature/src/main/java/org/apache/servicecomb/demo/signature/ClientSignature.java
@@ -47,7 +47,7 @@ public class ClientSignature implements HttpClientFilter {
     String serverSignature = responseEx.getHeader("signature");
 
     if (serverSignature != null) {
-      LOGGER.info("check response signature, client: {}, server: {}.", signature, serverSignature);
+      LOGGER.debug("check response signature, client: {}, server: {}.", signature, serverSignature);
       if (!signature.equals(serverSignature)) {
         LOGGER.error("check response signature failed");
         return Response.create(Status.UNAUTHORIZED, "check response signature failed");
diff --git a/demo/demo-signature/src/main/java/org/apache/servicecomb/demo/signature/ServerSignature.java b/demo/demo-signature/src/main/java/org/apache/servicecomb/demo/signature/ServerSignature.java
index 3554061..937aa7f 100644
--- a/demo/demo-signature/src/main/java/org/apache/servicecomb/demo/signature/ServerSignature.java
+++ b/demo/demo-signature/src/main/java/org/apache/servicecomb/demo/signature/ServerSignature.java
@@ -48,7 +48,7 @@ public class ServerSignature implements HttpServerFilter {
   public Response afterReceiveRequest(Invocation invocation, HttpServletRequestEx requestEx) {
     String signature = SignatureUtils.genSignature(requestEx);
     String clientSignature = requestEx.getHeader("signature");
-    LOGGER.info("check request signature, client: {}, server: {}.", clientSignature, signature);
+    LOGGER.debug("check request signature, client: {}, server: {}.", clientSignature, signature);
     if (!signature.equals(clientSignature)) {
       LOGGER.error("check request signature failed: {}", invocation.getInvocationQualifiedName());
       return Response


[incubator-servicecomb-java-chassis] 05/06: [SCB-793] make class-path in manifest.mf standard

Posted by li...@apache.org.
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/incubator-servicecomb-java-chassis.git

commit 6ff2f4dfc11716ff1c2f246011b403abdcbccda9
Author: wujimin <wu...@huawei.com>
AuthorDate: Thu Aug 9 10:57:37 2018 +0800

    [SCB-793] make class-path in manifest.mf standard
---
 integration-tests/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 9089eef..9ec78a8 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -187,7 +187,7 @@
                 <manifest>
                   <classpathLayoutType>repository</classpathLayoutType>
                   <addClasspath>true</addClasspath>
-                  <classpathPrefix>/${settings.localRepository}/</classpathPrefix>
+                  <classpathPrefix>file:///${settings.localRepository}/</classpathPrefix>
                   <mainClass>${it.main}</mainClass>
                 </manifest>
                 <manifestEntries>


[incubator-servicecomb-java-chassis] 04/06: [SCB-793] run it-consumer during travis CI

Posted by li...@apache.org.
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/incubator-servicecomb-java-chassis.git

commit 3893428f7002069ff02d78be3bace584ef20a21f
Author: wujimin <wu...@huawei.com>
AuthorDate: Wed Aug 8 22:19:15 2018 +0800

    [SCB-793] run it-consumer during travis CI
---
 .../src/test/java/org/apache/servicecomb/it/TestMain.java      | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/integration-tests/it-consumer/src/test/java/org/apache/servicecomb/it/TestMain.java b/integration-tests/it-consumer/src/test/java/org/apache/servicecomb/it/TestMain.java
index 62c8a82..ce4b42f 100644
--- a/integration-tests/it-consumer/src/test/java/org/apache/servicecomb/it/TestMain.java
+++ b/integration-tests/it-consumer/src/test/java/org/apache/servicecomb/it/TestMain.java
@@ -16,13 +16,15 @@
  */
 package org.apache.servicecomb.it;
 
+import org.apache.servicecomb.it.junit.ITJUnitUtils;
+import org.junit.Assert;
 import org.junit.Test;
 
 public class TestMain {
   @Test
-  public void testMain() {
-//    ConsumerMain.autoExit = false;
-//    ConsumerMain.main(new String[] {});
-//    Assert.assertTrue(ITJUnitUtils.getFailures().isEmpty());
+  public void testMain() throws Throwable {
+    ConsumerMain.autoExit = false;
+    ConsumerMain.main(new String[] {});
+    Assert.assertTrue(ITJUnitUtils.getFailures().isEmpty());
   }
 }


[incubator-servicecomb-java-chassis] 01/06: [SCB-793] SCBEngine output log after ready, that makes easier to check if a microservice instance is ready by read log.

Posted by li...@apache.org.
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/incubator-servicecomb-java-chassis.git

commit 5c6216ffcfb20221cf783084b2e296735e37bee3
Author: wujimin <wu...@huawei.com>
AuthorDate: Wed Aug 8 21:58:48 2018 +0800

    [SCB-793] SCBEngine output log after ready, that makes easier to check if a microservice instance is ready by read log.
---
 core/src/main/java/org/apache/servicecomb/core/SCBEngine.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
index aa42ded..6c5ccb3 100644
--- a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
+++ b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
@@ -155,6 +155,7 @@ public class SCBEngine {
           status = SCBStatus.UP;
           triggerEvent(EventType.AFTER_REGISTRY);
           EventManager.unregister(this);
+          LOGGER.info("ServiceComb is ready.");
         }
       }
     });


[incubator-servicecomb-java-chassis] 03/06: [SCB-793] support deploy serviceCenter: 1.reuse existing instance 2.deploy from environment "serviceCenterHome" 3.deploy from docker

Posted by li...@apache.org.
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/incubator-servicecomb-java-chassis.git

commit 1c5d87b21adcc899e569bc9dc9f1447b69ca8e32
Author: wujimin <wu...@huawei.com>
AuthorDate: Wed Aug 8 22:18:09 2018 +0800

    [SCB-793] support deploy serviceCenter:
    1.reuse existing instance
    2.deploy from environment "serviceCenterHome"
    3.deploy from docker
---
 .../org/apache/servicecomb/it/ConsumerMain.java    |  6 +-
 .../servicecomb/it/deploy/DeployDefinition.java    | 10 +++
 .../org/apache/servicecomb/it/deploy/Deploys.java  | 13 ++-
 .../apache/servicecomb/it/deploy/NormalDeploy.java |  7 +-
 .../servicecomb/it/deploy/ServiceCenterDeploy.java | 96 ++++++++++++++++++++++
 5 files changed, 127 insertions(+), 5 deletions(-)

diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
index 528f972..a52e787 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
@@ -39,13 +39,17 @@ public class ConsumerMain {
   public static boolean autoExit = true;
 
   public static void main(String[] args) throws Throwable {
+    deploys.init();
+    deploys.getServiceCenter().ensureReady();
+
     BeanUtils.init();
     ITUtils.waitBootFinished();
 
-    deploys.init();
     run();
 
     SCBEngine.getInstance().destroy();
+    deploys.getServiceCenter().stop();
+
     resultPrinter.print();
 
     if (autoExit) {
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/DeployDefinition.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/DeployDefinition.java
index f685e47..99becf4 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/DeployDefinition.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/DeployDefinition.java
@@ -25,6 +25,8 @@ public class DeployDefinition {
 
   protected String startCompleteLog;
 
+  protected String workDir;
+
   /**
    * <pre>
    * edge as the example:
@@ -67,6 +69,14 @@ public class DeployDefinition {
     this.startCompleteLog = startCompleteLog;
   }
 
+  public String getWorkDir() {
+    return workDir;
+  }
+
+  public void setWorkDir(String workDir) {
+    this.workDir = workDir;
+  }
+
   public String getCmd() {
     return cmd;
   }
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/Deploys.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/Deploys.java
index aae0dad..881ae6c 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/Deploys.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/Deploys.java
@@ -32,11 +32,17 @@ public class Deploys {
 
   private String pomVersion;
 
-  public MicroserviceDeploy edge;
+  private ServiceCenterDeploy serviceCenter;
 
-  public MicroserviceDeploy baseProducer;
+  private MicroserviceDeploy edge;
 
-  public MicroserviceDeploy zuul;
+  private MicroserviceDeploy baseProducer;
+
+  private MicroserviceDeploy zuul;
+
+  public ServiceCenterDeploy getServiceCenter() {
+    return serviceCenter;
+  }
 
   public MicroserviceDeploy getEdge() {
     return edge;
@@ -54,6 +60,7 @@ public class Deploys {
     initPomVersion();
     LOGGER.info("test version: {}", pomVersion);
 
+    serviceCenter = new ServiceCenterDeploy();
     initEdge();
     initBaseProducer();
 //    initZuul();
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java
index 146ea5e..8db1828 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java
@@ -18,6 +18,7 @@ package org.apache.servicecomb.it.deploy;
 
 
 import java.io.BufferedWriter;
+import java.io.File;
 import java.io.OutputStreamWriter;
 
 import org.apache.commons.io.IOUtils;
@@ -61,7 +62,11 @@ public class NormalDeploy {
   }
 
   protected ProcessBuilder createProcessBuilder(String[] cmds) {
-    return new ProcessBuilder(cmds).redirectErrorStream(true);
+    ProcessBuilder processBuilder = new ProcessBuilder(cmds).redirectErrorStream(true);
+    if (deployDefinition.getWorkDir() != null) {
+      processBuilder.directory(new File(deployDefinition.getWorkDir()));
+    }
+    return processBuilder;
   }
 
   public void waitStartComplete() {
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/ServiceCenterDeploy.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/ServiceCenterDeploy.java
new file mode 100644
index 0000000..9a38dbc
--- /dev/null
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/ServiceCenterDeploy.java
@@ -0,0 +1,96 @@
+/*
+ * 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.it.deploy;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.SystemUtils;
+import org.apache.servicecomb.serviceregistry.api.registry.ServiceCenterInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.client.RestTemplate;
+
+import io.swagger.util.Json;
+
+public class ServiceCenterDeploy extends NormalDeploy {
+  private static final Logger LOGGER = LoggerFactory.getLogger(ServiceCenterDeploy.class);
+
+  public ServiceCenterDeploy() {
+    super(new DeployDefinition());
+
+    deployDefinition.setDeployName("serviceCenter");
+    deployDefinition.setDisplayName("serviceCenter");
+    if (SystemUtils.IS_OS_WINDOWS) {
+      deployDefinition.setCmd("service-center.exe");
+    } else {
+      deployDefinition.setCmd("service-center");
+    }
+    deployDefinition.setStartCompleteLog("server is ready");
+  }
+
+  public void ensureReady() throws Throwable {
+    // check if is running
+    // {"version":"1.0.0","buildTag":"20180608145515.1.0.0.b913a2d","runMode":"dev","apiVersion":"3.0.0"}
+    try {
+      String address = "http://localhost:30100/version";
+      ServiceCenterInfo serviceCenterInfo = new RestTemplate().getForObject(address, ServiceCenterInfo.class);
+      if (serviceCenterInfo != null && serviceCenterInfo.getVersion() != null) {
+        LOGGER.info("{} already started, {}.", deployDefinition.getDisplayName(), Json.pretty(serviceCenterInfo));
+        return;
+      }
+    } catch (Throwable e) {
+      LOGGER.info("failed to get ServiceCenter version, message={}", e.getMessage());
+    }
+
+    initServiceCenterCmd();
+    LOGGER.info("definition of {} is: {}", deployDefinition.getDeployName(), deployDefinition);
+
+    deploy();
+    waitStartComplete();
+  }
+
+  protected void initServiceCenterCmd() throws IOException {
+    // where is service center
+    // 1.find from env, for local dev environment
+    LOGGER.info("try to find serviceCenter by env {}.", "serviceCenterHome");
+    String dir = System.getenv("serviceCenterHome");
+    if (dir != null) {
+      LOGGER.info("serviceCenterHome={}.", dir);
+      File file = new File(dir, deployDefinition.getCmd());
+      if (file.exists()) {
+        FileUtils.cleanDirectory(new File(dir, "data"));
+        deployDefinition.setWorkDir(dir);
+        deployDefinition.setCmd(file.getAbsolutePath());
+        return;
+      }
+
+      LOGGER.info("{} is not exist.", file.getAbsolutePath());
+    }
+
+    // 2.docker, for CI environment
+    LOGGER.info("can not find serviceCenter by env {}, try run by docker.", "serviceCenterHome");
+    deployDefinition.setCmd("docker");
+    deployDefinition.setArgs(new String[] {
+        "run",
+        "-p",
+        "127.0.0.1:30100:30100",
+        "servicecomb/service-center"
+    });
+  }
+}