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

ASF GitHub Bot commented on SCB-944:
------------------------------------

liubao68 closed pull request #932: [SCB-944] IT optimize
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/932
 
 
   

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

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

diff --git a/integration-tests/it-common/src/main/resources/logback.xml 
b/integration-tests/it-common/src/main/resources/logback.xml
index 625669066..d753514a0 100644
--- a/integration-tests/it-common/src/main/resources/logback.xml
+++ b/integration-tests/it-common/src/main/resources/logback.xml
@@ -23,8 +23,6 @@
       <pattern>%d [%level] [%thread] - %msg (%F:%L\)%n</pattern>
     </encoder>
   </appender>
-  <logger 
name="org.apache.servicecomb.core.definition.schema.ProducerSchemaFactory" 
level="OFF">
-  </logger>
   <root level="INFO">
     <appender-ref ref="STDOUT"/>
   </root>
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 8b5a45bff..e7455da26 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
@@ -109,13 +109,7 @@ protected static void run() throws Throwable {
     deploys.getEdge().stop();
   }
 
-  private static void testStandalone() throws Throwable {
-    deploys.getBaseProducer().ensureReady();
-
-    ITJUnitUtils.setProducerName("it-producer");
-
-    ITJUnitUtils.addParent("standalone");
-
+  private static void runShareTestCases() throws Throwable {
     ITJUnitUtils.runWithHighwayAndRest(TestChangeTransport.class);
     ITJUnitUtils.runWithHighwayAndRest(TestDataTypePrimitive.class);
     ITJUnitUtils.runWithHighwayAndRest(TestAnnotatedAttribute.class);
@@ -128,72 +122,48 @@ private static void testStandalone() throws Throwable {
 
     ITJUnitUtils.runWithHighwayAndRest(TestParamCodec.class);
     ITJUnitUtils.run(TestParamCodecEdge.class);
-    ITJUnitUtils.run(TestDefaultJsonValueJaxrsSchema.class);
-
-    ITJUnitUtils.runWithRest(TestRestServerConfig.class);
-    ITJUnitUtils.run(TestRestServerConfigEdge.class);
 
     ITJUnitUtils.run(TestRequestBodySpringMvcSchema.class);
-    ITJUnitUtils.run(Test3rdPartyInvocation.class);
-
-    ITJUnitUtils.getParents().pop();
-    deploys.getBaseProducer().stop();
+    ITJUnitUtils.run(TestDefaultJsonValueJaxrsSchema.class);
   }
 
-  private static void testSpringBoot2Standalone() throws Throwable {
-    deploys.getSpringBoot2StandaloneProducer().ensureReady();
-
-    ITJUnitUtils.setProducerName("it-producer-deploy-springboot2-standalone");
+  private static void testStandalone() throws Throwable {
+    deploys.getBaseProducer().ensureReady();
 
-    ITJUnitUtils.addParent("springBoot2Standalone");
+    ITJUnitUtils.addProducer("it-producer");
 
-    ITJUnitUtils.runWithHighwayAndRest(TestChangeTransport.class);
-    ITJUnitUtils.runWithHighwayAndRest(TestDataTypePrimitive.class);
-    ITJUnitUtils.runWithHighwayAndRest(TestAnnotatedAttribute.class);
+    runShareTestCases();
 
-    ITJUnitUtils.runWithRest(TestDefaultValue.class);
+    // currently not support update 3rd url, so only test once
+    ITJUnitUtils.run(Test3rdPartyInvocation.class);
 
-    ITJUnitUtils.runWithHighwayAndRest(TestTrace.class);
-    ITJUnitUtils.run(TestTraceEdge.class);
+    // about url len, different deploy have different url len, so only test 
standalone
+    ITJUnitUtils.runWithRest(TestRestServerConfig.class);
+    ITJUnitUtils.run(TestRestServerConfigEdge.class);
 
-    ITJUnitUtils.runWithHighwayAndRest(TestParamCodec.class);
-    ITJUnitUtils.run(TestParamCodecEdge.class);
+    ITJUnitUtils.popProducer();
+    deploys.getBaseProducer().stop();
+  }
 
-    //ITJUnitUtils.run(TestDefaultJsonValueJaxrsSchema.class);
+  private static void testSpringBoot2Standalone() throws Throwable {
+    deploys.getSpringBoot2StandaloneProducer().ensureReady();
 
-    ITJUnitUtils.runWithRest(TestRestServerConfig.class);
-    ITJUnitUtils.run(TestRestServerConfigEdge.class);
+    ITJUnitUtils.addProducer("it-producer-deploy-springboot2-standalone");
 
-    ITJUnitUtils.getParents().pop();
+    runShareTestCases();
 
+    ITJUnitUtils.popProducer();
     deploys.getSpringBoot2StandaloneProducer().stop();
   }
 
   private static void testSpringBoot2Servlet() throws Throwable {
     deploys.getSpringBoot2ServletProducer().ensureReady();
 
-    ITJUnitUtils.setProducerName("it-producer-deploy-springboot2-servlet");
-
-    ITJUnitUtils.addParent("springBoot2Servlet");
-
-    ITJUnitUtils.runWithHighwayAndRest(TestChangeTransport.class);
-    ITJUnitUtils.runWithHighwayAndRest(TestDataTypePrimitive.class);
-
-    ITJUnitUtils.runWithRest(TestDefaultValue.class);
-
-    ITJUnitUtils.runWithHighwayAndRest(TestTrace.class);
-    ITJUnitUtils.run(TestTraceEdge.class);
-
-    ITJUnitUtils.runWithHighwayAndRest(TestParamCodec.class);
-    ITJUnitUtils.run(TestParamCodecEdge.class);
-
-    //ITJUnitUtils.run(TestDefaultJsonValueJaxrsSchema.class);
-
-    //config by embedded tomcat
-    //ITJUnitUtils.runWithRest(TestRestServerConfig.class);
+    ITJUnitUtils.addProducer("it-producer-deploy-springboot2-servlet");
 
-    ITJUnitUtils.getParents().pop();
+    runShareTestCases();
 
+    ITJUnitUtils.popProducer();
     deploys.getSpringBoot2ServletProducer().stop();
   }
 }
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/Consumers.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/Consumers.java
index 5ed44ab33..ea24dad85 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/Consumers.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/Consumers.java
@@ -19,6 +19,7 @@
 import org.apache.servicecomb.it.extend.engine.GateRestTemplate;
 import org.apache.servicecomb.it.extend.engine.ITInvoker;
 import org.apache.servicecomb.it.extend.engine.ITSCBRestTemplate;
+import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.springframework.web.client.RestTemplate;
 
 public class Consumers<INTF> {
@@ -38,21 +39,18 @@
 
   private String transport;
 
-  public Consumers(String producerName, String schemaId, Class<INTF> intfCls) {
-    this.producerName = producerName;
+  public Consumers(String schemaId, Class<INTF> intfCls) {
     this.schemaId = schemaId;
     this.intfCls = intfCls;
-
-    scbRestTemplate = new ITSCBRestTemplate(producerName, schemaId);
-    edgeRestTemplate = new GateRestTemplate("it-edge", producerName, schemaId);
-    zuulRestTemplate = null;// 
GateRestTemplate.createZuulRestTemplate(producerName, schemaId);
   }
 
-  public void init(String transport) {
-    this.transport = transport;
+  public void init() {
+    this.producerName = ITJUnitUtils.getProducerName();
+    this.transport = ITJUnitUtils.getTransport();
     intf = ITInvoker.createProxy(producerName, schemaId, transport, intfCls);
-
-    scbRestTemplate.setTransport(transport);
+    scbRestTemplate = new ITSCBRestTemplate(schemaId).init();
+    edgeRestTemplate = 
GateRestTemplate.createEdgeRestTemplate(schemaId).init();
+    zuulRestTemplate = null;// 
GateRestTemplate.createZuulRestTemplate(schemaId).init();
   }
 
   public String getSchemaId() {
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 8db18287f..bb91446b5 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
@@ -20,10 +20,13 @@
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.OutputStreamWriter;
+import java.util.Collections;
+import java.util.List;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.servicecomb.foundation.common.utils.JsonUtils;
+import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -38,6 +41,8 @@
 
   protected SubProcessLogger subProcessLogger;
 
+  private int prevFailCount;
+
   public NormalDeploy(DeployDefinition deployDefinition) {
     this.deployDefinition = deployDefinition;
   }
@@ -46,6 +51,8 @@ public void deploy() throws Throwable {
     String[] cmds = createCmds();
     cmds = addArgs(cmds);
 
+    this.prevFailCount = ITJUnitUtils.getFailures().size();
+
     subProcess = createProcessBuilder(cmds).start();
     subProcessCommandWriter = new BufferedWriter(new 
OutputStreamWriter(subProcess.getOutputStream()));
     subProcessLogger = new SubProcessLogger(deployDefinition.getDisplayName(), 
subProcess.getInputStream(),
@@ -88,8 +95,16 @@ protected void afterStop() {
     IOUtils.closeQuietly(subProcessCommandWriter);
     subProcessCommandWriter = null;
 
+    SubProcessLogger old = subProcessLogger;
     IOUtils.closeQuietly(subProcessLogger);
     subProcessLogger = null;
+
+    if (prevFailCount != ITJUnitUtils.getFailures().size()) {
+      List<String> logs = old.getAndClearLog();
+      for (String line : logs) {
+        System.out.println(line);
+      }
+    }
   }
 
   public void waitStop() {
@@ -124,4 +139,13 @@ public void stop() {
     afterStop();
     LOGGER.info("stop complete, displayName={}.", 
deployDefinition.getDisplayName());
   }
+
+  public List<String> getAndClearLog() {
+    SubProcessLogger logger = subProcessLogger;
+    if (logger != null) {
+      return logger.getAndClearLog();
+    }
+
+    return Collections.emptyList();
+  }
 }
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 86d7f6945..3e3243f10 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,6 +22,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.servicecomb.it.ITUtils;
@@ -41,6 +43,8 @@
 
   private volatile boolean startCompleted;
 
+  private List<String> logs = new ArrayList<>();
+
   public SubProcessLogger(String displayName, InputStream inputStream, String 
startCompleteLog) {
     this.displayName = displayName;
     this.startCompleteLog = startCompleteLog;
@@ -63,13 +67,18 @@ private void run() {
   private void doRun() throws IOException {
     String line;
     while ((line = reader.readLine()) != null) {
-      System.out.print(String.format("[%s] ", displayName));
-      System.out.println(line);
+      logs.add(String.format("[%s] %s", displayName, line));
 
       checkStartComplete(line);
     }
   }
 
+  public List<String> getAndClearLog() {
+    List<String> old = logs;
+    logs = new ArrayList<>();
+    return old;
+  }
+
   private void checkStartComplete(String line) {
     if (startCompleted || startCompleteLog == null) {
       return;
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/GateRestTemplate.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/GateRestTemplate.java
index b2b91c68b..5378d196f 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/GateRestTemplate.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/GateRestTemplate.java
@@ -21,6 +21,7 @@
 import org.apache.servicecomb.core.definition.MicroserviceVersionMeta;
 import org.apache.servicecomb.core.definition.SchemaMeta;
 import org.apache.servicecomb.foundation.common.net.URIEndpointObject;
+import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.apache.servicecomb.serviceregistry.RegistryUtils;
 import 
org.apache.servicecomb.serviceregistry.api.registry.MicroserviceInstance;
 import org.apache.servicecomb.serviceregistry.consumer.MicroserviceVersionRule;
@@ -30,11 +31,27 @@
 import org.springframework.web.client.RestTemplate;
 
 public class GateRestTemplate extends RestTemplate {
+  private final String gateName;
+
+  private final String schemaId;
 
   private String urlPrefix;
 
-  public GateRestTemplate(String gateName, String producerName, String 
schemaId) {
-    urlPrefix = getUrlPrefix(gateName, producerName, schemaId);
+  public static GateRestTemplate createEdgeRestTemplate(String schemaId) {
+    return new GateRestTemplate("it-edge", schemaId);
+  }
+
+  public static GateRestTemplate createZuulRestTemplate(String schemaId) {
+    return new GateRestTemplate("it-zuul", schemaId);
+  }
+
+  public GateRestTemplate(String gateName, String schemaId) {
+    this.gateName = gateName;
+    this.schemaId = schemaId;
+  }
+
+  public GateRestTemplate init() {
+    urlPrefix = getUrlPrefix(gateName, ITJUnitUtils.getProducerName(), 
schemaId);
 
     setUriTemplateHandler(new ITUriTemplateHandler(urlPrefix));
 
@@ -42,6 +59,8 @@ public GateRestTemplate(String gateName, String producerName, 
String schemaId) {
         new MappingJackson2HttpMessageConverter(),
         new StringHttpMessageConverter()
     ));
+
+    return this;
   }
 
   public String getUrlPrefix() {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/ITClientHttpRequestFactory.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/ITClientHttpRequestFactory.java
index 5ec5ba60e..a5def644c 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/ITClientHttpRequestFactory.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/ITClientHttpRequestFactory.java
@@ -18,6 +18,7 @@
 
 import java.net.URI;
 
+import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import 
org.apache.servicecomb.provider.springmvc.reference.CseClientHttpRequestFactory;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.client.ClientHttpRequest;
@@ -25,8 +26,8 @@
 public class ITClientHttpRequestFactory extends CseClientHttpRequestFactory {
   private String transport;
 
-  public void setTransport(String transport) {
-    this.transport = transport;
+  public ITClientHttpRequestFactory() {
+    this.transport = ITJUnitUtils.getTransport();
   }
 
   @Override
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/ITSCBRestTemplate.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/ITSCBRestTemplate.java
index 9956e503f..8446b9324 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/ITSCBRestTemplate.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/extend/engine/ITSCBRestTemplate.java
@@ -18,16 +18,23 @@
 
 import org.apache.servicecomb.core.definition.MicroserviceVersionMeta;
 import org.apache.servicecomb.core.definition.SchemaMeta;
+import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.apache.servicecomb.provider.springmvc.reference.CseRestTemplate;
 import org.apache.servicecomb.serviceregistry.RegistryUtils;
 import org.apache.servicecomb.serviceregistry.consumer.MicroserviceVersionRule;
 import org.apache.servicecomb.serviceregistry.definition.DefinitionConst;
 
 public class ITSCBRestTemplate extends CseRestTemplate {
-
   private String urlPrefix;
 
-  public ITSCBRestTemplate(String producerName, String schemaId) {
+  private String schemaId;
+
+  public ITSCBRestTemplate(String schemaId) {
+    this.schemaId = schemaId;
+  }
+
+  public ITSCBRestTemplate init() {
+    String producerName = ITJUnitUtils.getProducerName();
     MicroserviceVersionRule microserviceVersionRule = 
RegistryUtils.getServiceRegistry().getAppManager()
         .getOrCreateMicroserviceVersionRule(RegistryUtils.getAppId(), 
producerName,
             DefinitionConst.VERSION_RULE_ALL);
@@ -37,10 +44,8 @@ public ITSCBRestTemplate(String producerName, String 
schemaId) {
 
     setUriTemplateHandler(new ITUriTemplateHandler(urlPrefix));
     setRequestFactory(new ITClientHttpRequestFactory());
-  }
 
-  public void setTransport(String transport) {
-    ((ITClientHttpRequestFactory) getRequestFactory()).setTransport(transport);
+    return this;
   }
 
   public String getUrlPrefix() {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/junit/ITJUnitUtils.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/junit/ITJUnitUtils.java
index edf253fc7..522f12844 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/junit/ITJUnitUtils.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/junit/ITJUnitUtils.java
@@ -17,14 +17,20 @@
 package org.apache.servicecomb.it.junit;
 
 import java.io.IOException;
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Stack;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.apache.commons.lang3.reflect.MethodUtils;
 import org.apache.servicecomb.core.Const;
 import org.apache.servicecomb.foundation.common.utils.JvmUtils;
+import org.apache.servicecomb.it.Consumers;
+import org.apache.servicecomb.it.extend.engine.GateRestTemplate;
+import org.apache.servicecomb.it.extend.engine.ITSCBRestTemplate;
 import org.junit.runner.JUnitCore;
 import org.junit.runner.Result;
 import org.junit.runner.notification.Failure;
@@ -91,6 +97,16 @@ public static void popTransport() {
     popParent();
   }
 
+  public static void addProducer(String producerName) {
+    ITJUnitUtils.setProducerName(producerName);
+    parents.add(producerName);
+  }
+
+  public static void popProducer() {
+    ITJUnitUtils.setProducerName(null);
+    parents.pop();
+  }
+
   public static void addParent(String name) {
     parents.add(name);
   }
@@ -107,16 +123,30 @@ public static void popParent() {
     return failures;
   }
 
-  public static void runFromPackage(String packageName) {
+  public static void runFromPackage(String packageName) throws Throwable {
     Class<?>[] classes = findAllClassInPackage(packageName);
     run(classes);
   }
 
-  public static void run(Class<?>... classes) {
+  public static void run(Class<?>... classes) throws Throwable {
+    initClasses(classes);
     Result result = jUnitCore.run(classes);
     runCount.addAndGet(result.getRunCount());
   }
 
+  private static void initClasses(Class<?>[] classes) throws Throwable {
+    for (Class<?> cls : classes) {
+      for (Field field : FieldUtils.getAllFieldsList(cls)) {
+        if (Consumers.class.isAssignableFrom(field.getType())
+            || GateRestTemplate.class.isAssignableFrom(field.getType())
+            || ITSCBRestTemplate.class.isAssignableFrom(field.getType())) {
+          Object target = FieldUtils.readStaticField(field, true);
+          MethodUtils.invokeMethod(target, "init");
+        }
+      }
+    }
+  }
+
   public static Class<?>[] findAllClassInPackage(String packageName) {
     try {
       return ClassPath.from(classLoader)
@@ -128,15 +158,15 @@ public static void run(Class<?>... classes) {
     }
   }
 
-  public static void runWithHighwayAndRest(Class<?>... classes) {
+  public static void runWithHighwayAndRest(Class<?>... classes) throws 
Throwable {
     runWithTransports(Arrays.asList(Const.HIGHWAY, Const.RESTFUL), classes);
   }
 
-  public static void runWithRest(Class<?>... classes) {
+  public static void runWithRest(Class<?>... classes) throws Throwable {
     runWithTransports(Arrays.asList(Const.RESTFUL), classes);
   }
 
-  public static void runWithTransports(List<String> transports, Class<?>... 
classes) {
+  public static void runWithTransports(List<String> transports, Class<?>... 
classes) throws Throwable {
     for (String transport : transports) {
       ITJUnitUtils.pushTransport(transport);
 
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAnnotatedAttribute.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAnnotatedAttribute.java
index 37a5b1f4e..732f62c20 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAnnotatedAttribute.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAnnotatedAttribute.java
@@ -22,8 +22,6 @@
 import java.util.Map;
 
 import org.apache.servicecomb.it.Consumers;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
-import org.junit.Before;
 import org.junit.Test;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
@@ -37,18 +35,8 @@
     String fromHeader(String inputs);
   }
 
-  private static Consumers<AnnotatedAttributeIntf> consumersSpringmvc;
-
-  private static String producerName;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      consumersSpringmvc = new Consumers<>(producerName, 
"annotatedAttributeSpringmvc", AnnotatedAttributeIntf.class);
-      consumersSpringmvc.init(ITJUnitUtils.getTransport());
-    }
-  }
+  private static Consumers<AnnotatedAttributeIntf> consumersSpringmvc =
+      new Consumers<>("annotatedAttributeSpringmvc", 
AnnotatedAttributeIntf.class);
 
   @Test
   public void fromHeader_springmvc_rt() {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestChangeTransport.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestChangeTransport.java
index a7be7bc65..633dad089 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestChangeTransport.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestChangeTransport.java
@@ -17,9 +17,7 @@
 package org.apache.servicecomb.it.testcase;
 
 import org.apache.servicecomb.it.Consumers;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 
 public class TestChangeTransport {
@@ -27,26 +25,12 @@
     String checkTransport();
   }
 
-  private static Consumers<ChangeTranportIntf> consumersPojo;
+  static Consumers<ChangeTranportIntf> consumersPojo = new 
Consumers<>("transportPojo", ChangeTranportIntf.class);
 
-  private static Consumers<ChangeTranportIntf> consumersJaxrs;
+  static Consumers<ChangeTranportIntf> consumersJaxrs = new 
Consumers<>("transportJaxrs", ChangeTranportIntf.class);
 
-  private static Consumers<ChangeTranportIntf> consumersSpringmvc;
-
-  private static String producerName;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      consumersPojo = new Consumers<>(producerName, "transportPojo", 
ChangeTranportIntf.class);
-      consumersJaxrs = new Consumers<>(producerName, "transportJaxrs", 
ChangeTranportIntf.class);
-      consumersSpringmvc = new Consumers<>(producerName, "transportSpringmvc", 
ChangeTranportIntf.class);
-      consumersPojo.init(ITJUnitUtils.getTransport());
-      consumersJaxrs.init(ITJUnitUtils.getTransport());
-      consumersSpringmvc.init(ITJUnitUtils.getTransport());
-    }
-  }
+  static Consumers<ChangeTranportIntf> consumersSpringmvc = new 
Consumers<>("transportSpringmvc",
+      ChangeTranportIntf.class);
 
   void checkTransport_intf(Consumers<ChangeTranportIntf> consumers) {
     Assert.assertEquals(consumers.getTransport(), 
consumers.getIntf().checkTransport());
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDataTypePrimitive.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDataTypePrimitive.java
index 83423cebd..82d505c51 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDataTypePrimitive.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDataTypePrimitive.java
@@ -24,8 +24,6 @@
 
 import org.apache.servicecomb.it.Consumers;
 import org.apache.servicecomb.it.extend.engine.ITSCBRestTemplate;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
-import org.junit.BeforeClass;
 import org.junit.Test;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
@@ -94,24 +92,13 @@
     double doubleAdd(double num1, double num2);
   }
 
-  private static Consumers<DataTypePojoIntf> consumersPojo;
+  private static Consumers<DataTypePojoIntf> consumersPojo = new 
Consumers<>("dataTypePojo", DataTypePojoIntf.class);
 
-  private static Consumers<DataTypeRestIntf> consumersJaxrs;
+  private static Consumers<DataTypeRestIntf> consumersJaxrs =
+      new Consumers<>("dataTypeJaxrs", DataTypeRestIntf.class);
 
-  private static Consumers<DataTypeRestIntf> consumersSpringmvc;
-
-  private static String producerName;
-
-  @BeforeClass
-  public static void beforeClass() {
-    producerName = ITJUnitUtils.getProducerName();
-    consumersPojo = new Consumers<>(producerName, "dataTypePojo", 
DataTypePojoIntf.class);
-    consumersJaxrs = new Consumers<>(producerName, "dataTypeJaxrs", 
DataTypeRestIntf.class);
-    consumersSpringmvc = new Consumers<>(producerName, "dataTypeSpringmvc", 
DataTypeRestIntf.class);
-    consumersPojo.init(ITJUnitUtils.getTransport());
-    consumersJaxrs.init(ITJUnitUtils.getTransport());
-    consumersSpringmvc.init(ITJUnitUtils.getTransport());
-  }
+  private static Consumers<DataTypeRestIntf> consumersSpringmvc = new 
Consumers<>("dataTypeSpringmvc",
+      DataTypeRestIntf.class);
 
   @Test
   public void int_pojo_intf() {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultJsonValueJaxrsSchema.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultJsonValueJaxrsSchema.java
index 6594c9d35..1e966a675 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultJsonValueJaxrsSchema.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultJsonValueJaxrsSchema.java
@@ -22,28 +22,14 @@
 import java.util.Map;
 
 import org.apache.servicecomb.it.extend.engine.GateRestTemplate;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
-import org.springframework.web.client.RestTemplate;
 
 public class TestDefaultJsonValueJaxrsSchema {
-  private static RestTemplate client;
-
-  private static String producerName;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      client = new GateRestTemplate("it-edge", producerName, 
"defaultJsonValueJaxrs");
-    }
-  }
-
+  static GateRestTemplate client = 
GateRestTemplate.createEdgeRestTemplate("defaultJsonValueJaxrs");
 
   @Test
   public void invokeFromEdgeWithQuery() {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultValue.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultValue.java
index 60552bd7c..8d55dd35d 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultValue.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultValue.java
@@ -19,8 +19,6 @@
 import static org.junit.Assert.assertEquals;
 
 import org.apache.servicecomb.it.Consumers;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
-import org.junit.Before;
 import org.junit.Test;
 
 public class TestDefaultValue {
@@ -70,22 +68,11 @@
 
   private double defaultDouble = 10.2;
 
-  private static Consumers<DefaultValueIntf> consumersJaxrs;
+  private static Consumers<DefaultValueIntf> consumersJaxrs = new 
Consumers<>("defaultValueJaxrs",
+      DefaultValueIntf.class);
 
-  private static Consumers<DefaultValueRequireIntf> consumersSpringmvc;
-
-  private static String producerName;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      consumersJaxrs = new Consumers<>(producerName, "defaultValueJaxrs", 
DefaultValueIntf.class);
-      consumersSpringmvc = new Consumers<>(producerName, 
"defaultValueSpringmvc", DefaultValueRequireIntf.class);
-      consumersJaxrs.init(ITJUnitUtils.getTransport());
-      consumersSpringmvc.init(ITJUnitUtils.getTransport());
-    }
-  }
+  private static Consumers<DefaultValueRequireIntf> consumersSpringmvc = new 
Consumers<>("defaultValueSpringmvc",
+      DefaultValueRequireIntf.class);
 
   @Test
   public void intQuery_jaxrs_intf() {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodec.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodec.java
index d4a376eed..8a2bc252c 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodec.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodec.java
@@ -20,8 +20,6 @@
 import static org.junit.Assert.assertEquals;
 
 import org.apache.servicecomb.it.Consumers;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
-import org.junit.Before;
 import org.junit.Test;
 
 public class TestParamCodec {
@@ -29,18 +27,7 @@
     String spaceCharCodec(String pathVal, String q);
   }
 
-  private static Consumers<ParamCodecSchemaIntf> consumers;
-
-  private static String producerName;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      consumers = new Consumers<>(producerName, "paramCodec", 
ParamCodecSchemaIntf.class);
-      consumers.init(ITJUnitUtils.getTransport());
-    }
-  }
+  static Consumers<ParamCodecSchemaIntf> consumers = new 
Consumers<>("paramCodec", ParamCodecSchemaIntf.class);
 
   @Test
   public void spaceCharEncode_intf() {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodecEdge.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodecEdge.java
index 250b84e97..408efe023 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodecEdge.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodecEdge.java
@@ -20,23 +20,10 @@
 import static org.junit.Assert.assertEquals;
 
 import org.apache.servicecomb.it.extend.engine.GateRestTemplate;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
-import org.junit.Before;
 import org.junit.Test;
-import org.springframework.web.client.RestTemplate;
 
 public class TestParamCodecEdge {
-  private static RestTemplate client;
-
-  private static String producerName;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      client = new GateRestTemplate("it-edge", producerName, "paramCodec");
-    }
-  }
+  static GateRestTemplate client = 
GateRestTemplate.createEdgeRestTemplate("paramCodec");
 
   @Test
   public void spaceCharEncode() {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRequestBodySpringMvcSchema.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRequestBodySpringMvcSchema.java
index f51322dcf..ac292b2a4 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRequestBodySpringMvcSchema.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRequestBodySpringMvcSchema.java
@@ -21,27 +21,14 @@
 import java.util.Map;
 
 import org.apache.servicecomb.it.extend.engine.GateRestTemplate;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
-import org.springframework.web.client.RestTemplate;
 
 public class TestRequestBodySpringMvcSchema {
-  private static RestTemplate edgeClient;
-
-  private static String producerName;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      edgeClient = new GateRestTemplate("it-edge", producerName, 
"requestBodySpringMvcSchema");
-    }
-  }
+  private static GateRestTemplate edgeClient = 
GateRestTemplate.createEdgeRestTemplate("requestBodySpringMvcSchema");
 
   @Test
   public void basicRequestResponse() {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestServerConfig.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestServerConfig.java
index cdced0f39..9adfb2181 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestServerConfig.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestServerConfig.java
@@ -18,10 +18,8 @@
 package org.apache.servicecomb.it.testcase;
 
 import org.apache.servicecomb.it.Consumers;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 
 import com.google.common.base.Strings;
@@ -36,18 +34,8 @@
     String testMaxInitialLineLength(String q);
   }
 
-  private static String producerName;
-
-  private static Consumers<RestServerConfigSchemaIntf> consumers;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      consumers = new Consumers<>(producerName, "restServerConfig", 
RestServerConfigSchemaIntf.class);
-      consumers.init(ITJUnitUtils.getTransport());
-    }
-  }
+  static Consumers<RestServerConfigSchemaIntf> consumers = new 
Consumers<>("restServerConfig",
+      RestServerConfigSchemaIntf.class);
 
   /**
    * Max initial line length is set to 5000
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestServerConfigEdge.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestServerConfigEdge.java
index 1f0f30cd0..ac4c55202 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestServerConfigEdge.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestServerConfigEdge.java
@@ -26,25 +26,13 @@
 import java.util.Scanner;
 
 import org.apache.servicecomb.it.extend.engine.GateRestTemplate;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 import org.springframework.web.client.HttpClientErrorException;
 import org.springframework.web.client.RestClientException;
 
 public class TestRestServerConfigEdge {
-  private static GateRestTemplate client;
-
-  private static String producerName;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      client = new GateRestTemplate("it-edge", producerName, "dataTypeJaxrs");
-    }
-  }
+  static GateRestTemplate client = (GateRestTemplate) 
GateRestTemplate.createEdgeRestTemplate("dataTypeJaxrs");
 
   @Test
   public void testIllegalPathParam() throws IOException {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestTrace.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestTrace.java
index 4e908f055..df4a6ad2a 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestTrace.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestTrace.java
@@ -21,12 +21,11 @@
 
 import org.apache.servicecomb.core.Const;
 import org.apache.servicecomb.it.Consumers;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.apache.servicecomb.swagger.invocation.context.ContextUtils;
 import org.apache.servicecomb.swagger.invocation.context.InvocationContext;
-import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Assert;
-import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class TestTrace {
@@ -34,26 +33,17 @@
     CompletableFuture<String> echoProxy();
   }
 
-  private static Consumers<TraceSchemaIntf> consumers;
-
-
-  private static String producerName;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      consumers = new Consumers<>(producerName, "trace", 
TraceSchemaIntf.class);
-      consumers.init(ITJUnitUtils.getTransport());
-    }
+  static Consumers<TraceSchemaIntf> consumers = new Consumers<>("trace", 
TraceSchemaIntf.class);
 
+  @BeforeClass
+  public static void classSetup() {
     InvocationContext context = new InvocationContext();
     context.addContext(Const.TRACE_ID_NAME, "testId");
     ContextUtils.setInvocationContext(context);
   }
 
-  @After
-  public void teardown() {
+  @AfterClass
+  public static void classTeardown() {
     ContextUtils.removeInvocationContext();
   }
 
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestTraceEdge.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestTraceEdge.java
index 3244fb5c8..06b08bfeb 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestTraceEdge.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestTraceEdge.java
@@ -18,27 +18,14 @@
 
 import org.apache.servicecomb.core.Const;
 import org.apache.servicecomb.it.extend.engine.GateRestTemplate;
-import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
-import org.springframework.web.client.RestTemplate;
 
 public class TestTraceEdge {
-  private static RestTemplate client;
-
-  private static String producerName;
-
-  @Before
-  public void prepare() {
-    if (!ITJUnitUtils.getProducerName().equals(producerName)) {
-      producerName = ITJUnitUtils.getProducerName();
-      client = new GateRestTemplate("it-edge", producerName, "trace");
-    }
-  }
+  static GateRestTemplate client = 
GateRestTemplate.createEdgeRestTemplate("trace");
 
   @Test
   public void echo() {
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/thirdparty/Test3rdPartyInvocation.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/thirdparty/Test3rdPartyInvocation.java
index fec1f81c1..c0086c591 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/thirdparty/Test3rdPartyInvocation.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/thirdparty/Test3rdPartyInvocation.java
@@ -53,7 +53,7 @@
   private static final String ASYNC_THIRD_PARTY_MICROSERVICE_NAME = 
THIRD_PARTY_MICROSERVICE_NAME + "Async";
 
   // to get endpoint from urlPrefix
-  static GateRestTemplate rt = new GateRestTemplate("it-edge", "it-producer", 
"dataTypeJaxrs");
+  static GateRestTemplate rt = 
GateRestTemplate.createEdgeRestTemplate("dataTypeJaxrs");
 
   private static DataTypeJaxrsSchemaIntf dataTypeJaxrsSchema;
 
diff --git a/integration-tests/it-consumer/src/main/resources/logback.xml 
b/integration-tests/it-consumer/src/main/resources/logback.xml
deleted file mode 100644
index 3973b23a2..000000000
--- a/integration-tests/it-consumer/src/main/resources/logback.xml
+++ /dev/null
@@ -1,30 +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.
-  -->
-
-<configuration>
-
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - 
%msg%n</pattern>
-    </encoder>
-  </appender>
-
-  <root level="WARN">
-    <appender-ref ref="STDOUT" />
-  </root>
-
-</configuration>
\ No newline at end of file
diff --git a/integration-tests/it-edge/src/main/resources/microservice.yaml 
b/integration-tests/it-edge/src/main/resources/microservice.yaml
index df5296ad4..e5c6ea928 100644
--- a/integration-tests/it-edge/src/main/resources/microservice.yaml
+++ b/integration-tests/it-edge/src/main/resources/microservice.yaml
@@ -39,6 +39,18 @@ servicecomb:
           transport: rest
         queryInput:
           transport: rest
+    it-producer-deploy-springboot2-servlet:
+      defaultJsonValueJaxrs:
+        jsonInput:
+          transport: rest
+        queryInput:
+          transport: rest
+    it-producer-deploy-springboot2-standalone:
+      defaultJsonValueJaxrs:
+        jsonInput:
+          transport: rest
+        queryInput:
+          transport: rest
   http:
     dispatcher:
       edge:
diff --git 
a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/TraceSchema.java
 
b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/TraceSchema.java
index 6ded8879a..93e8ccbd2 100644
--- 
a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/TraceSchema.java
+++ 
b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/TraceSchema.java
@@ -16,17 +16,20 @@
  */
 package org.apache.servicecomb.it.schema;
 
+import static 
org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_QUALIFIED_MICROSERVICE_NAME_KEY;
+
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 
 import org.apache.servicecomb.core.Const;
 import org.apache.servicecomb.provider.pojo.Invoker;
 import org.apache.servicecomb.provider.rest.common.RestSchema;
-import org.apache.servicecomb.serviceregistry.RegistryUtils;
 import org.apache.servicecomb.swagger.invocation.context.InvocationContext;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import com.netflix.config.DynamicPropertyFactory;
+
 @RestSchema(schemaId = "trace")
 @RequestMapping(path = "/v1/trace")
 public class TraceSchema {
@@ -34,7 +37,10 @@
     CompletableFuture<String> echo();
   }
 
-  TraceSchemaIntf intf;
+  TraceSchemaIntf intf = Invoker.createProxy(
+      
DynamicPropertyFactory.getInstance().getStringProperty(CONFIG_QUALIFIED_MICROSERVICE_NAME_KEY,
 null).get(),
+      "trace",
+      TraceSchemaIntf.class);
 
   @GetMapping(path = "echo")
   public String echo(InvocationContext context) {
@@ -43,13 +49,6 @@ public String echo(InvocationContext context) {
 
   @GetMapping(path = "echo-proxy")
   public String echoProxy() throws ExecutionException, InterruptedException {
-    initTraceSchemaIntf();
     return intf.echo().get();
   }
-
-  private void initTraceSchemaIntf() {
-    if (intf == null) {
-      intf = 
Invoker.createProxy(RegistryUtils.getMicroservice().getServiceName(), "trace", 
TraceSchemaIntf.class);
-    }
-  }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> make control IT deploy simpler and print less log
> -------------------------------------------------
>
>                 Key: SCB-944
>                 URL: https://issues.apache.org/jira/browse/SCB-944
>             Project: Apache ServiceComb
>          Issue Type: Task
>          Components: Java-Chassis
>            Reporter: wujimin
>            Assignee: wujimin
>            Priority: Major
>




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

Reply via email to