You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2018/11/08 03:09:05 UTC

[incubator-skywalking] branch sw6-header updated: Fix CI and make user cases still work under v1 header.

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

wusheng pushed a commit to branch sw6-header
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git


The following commit(s) were added to refs/heads/sw6-header by this push:
     new 1f240ee  Fix CI and make user cases still work under v1 header.
1f240ee is described below

commit 1f240ee4d05437884465030fe2c4a750dbf04fac
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Thu Nov 8 11:08:55 2018 +0800

    Fix CI and make user cases still work under v1 header.
---
 .../activemq/ActiveMQConsumerInterceptor.java      | 28 +++++-----
 .../activemq/ActiveMQConsumerInterceptorTest.java  | 18 ++++---
 .../kafka/v11/KafkaConsumerInterceptorTest.java    |  8 +++
 .../sofarpc/SofaRpcProviderInterceptorTest.java    | 13 +++--
 .../v2x/ExecuteRootHandlerInterceptorTest.java     | 12 ++++-
 .../opentracing/SkywalkingSpanActivationTest.java  | 63 ++++++++++++----------
 6 files changed, 90 insertions(+), 52 deletions(-)

diff --git a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptor.java b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptor.java
index be81bf5..f4d3706 100644
--- a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptor.java
@@ -18,6 +18,7 @@
 
 package org.apache.skywalking.apm.plugin.activemq;
 
+import java.lang.reflect.Method;
 import org.apache.activemq.command.MessageDispatch;
 import org.apache.skywalking.apm.agent.core.context.CarrierItem;
 import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
@@ -30,8 +31,6 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceM
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
 import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
 
-import java.lang.reflect.Method;
-
 /**
  * @author withlin
  */
@@ -43,17 +42,19 @@ public class ActiveMQConsumerInterceptor implements InstanceMethodsAroundInterce
     public static final byte TOPIC_TYPE = 2;
     public static final byte TEMP_TOPIC_TYPE = 6;
     public static final byte TEMP_QUEUE_TYPE = 5;
+
     @Override
-    public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
+    public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
+        MethodInterceptResult result) throws Throwable {
         ContextCarrier contextCarrier = new ContextCarrier();
-        String url = (String) objInst.getSkyWalkingDynamicField();
-        MessageDispatch messageDispatch = (MessageDispatch) allArguments[0];
+        String url = (String)objInst.getSkyWalkingDynamicField();
+        MessageDispatch messageDispatch = (MessageDispatch)allArguments[0];
         AbstractSpan activeSpan = null;
-        if (messageDispatch.getDestination().getDestinationType() == QUEUE_TYPE ||  messageDispatch.getDestination().getDestinationType() == TEMP_QUEUE_TYPE) {
+        if (messageDispatch.getDestination().getDestinationType() == QUEUE_TYPE || messageDispatch.getDestination().getDestinationType() == TEMP_QUEUE_TYPE) {
             activeSpan = ContextManager.createEntrySpan(OPERATE_NAME_PREFIX + "Queue/" + messageDispatch.getDestination().getPhysicalName() + CONSUMER_OPERATE_NAME_SUFFIX, null).start(System.currentTimeMillis());
             Tags.MQ_BROKER.set(activeSpan, url);
             Tags.MQ_QUEUE.set(activeSpan, messageDispatch.getDestination().getPhysicalName());
-        } else if (messageDispatch.getDestination().getDestinationType() == TOPIC_TYPE ||  messageDispatch.getDestination().getDestinationType() == TEMP_TOPIC_TYPE) {
+        } else if (messageDispatch.getDestination().getDestinationType() == TOPIC_TYPE || messageDispatch.getDestination().getDestinationType() == TEMP_TOPIC_TYPE) {
             activeSpan = ContextManager.createEntrySpan(OPERATE_NAME_PREFIX + "Topic/" + messageDispatch.getDestination().getPhysicalName() + CONSUMER_OPERATE_NAME_SUFFIX, null).start(System.currentTimeMillis());
             Tags.MQ_BROKER.set(activeSpan, url);
             Tags.MQ_TOPIC.set(activeSpan, messageDispatch.getDestination().getPhysicalName());
@@ -63,23 +64,26 @@ public class ActiveMQConsumerInterceptor implements InstanceMethodsAroundInterce
         CarrierItem next = contextCarrier.items();
         while (next.hasNext()) {
             next = next.next();
-            next.setHeadValue(messageDispatch.getMessage().getProperty(next.getHeadKey()).toString());
+            Object propertyValue = messageDispatch.getMessage().getProperty(next.getHeadKey());
+            if (propertyValue != null) {
+                next.setHeadValue(propertyValue.toString());
+            }
         }
         ContextManager.extract(contextCarrier);
 
-
     }
 
-
     @Override
-    public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable {
+    public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
+        Object ret) throws Throwable {
         ContextManager.stopSpan();
         return ret;
 
     }
 
     @Override
-    public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
+    public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
+        Class<?>[] argumentsTypes, Throwable t) {
         ContextManager.activeSpan().errorOccurred().log(t);
     }
 }
diff --git a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptorTest.java
index ea77903..38e7dec 100644
--- a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptorTest.java
+++ b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptorTest.java
@@ -16,7 +16,6 @@
  *
  */
 
-
 package org.apache.skywalking.apm.plugin.activemq;
 
 import org.apache.activemq.command.ActiveMQDestination;
@@ -24,6 +23,7 @@ import org.apache.activemq.command.Message;
 import org.apache.activemq.command.MessageDispatch;
 import org.apache.activemq.command.Response;
 import org.apache.activemq.state.CommandVisitor;
+import org.apache.skywalking.apm.agent.core.conf.Config;
 import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
 import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
@@ -62,7 +62,7 @@ public class ActiveMQConsumerInterceptorTest {
 
     private MessageDispatch messageDispatch;
 
-    public  class  Des extends ActiveMQDestination {
+    public class Des extends ActiveMQDestination {
 
         @Override
         protected String getQualifiedPrefix() {
@@ -80,7 +80,7 @@ public class ActiveMQConsumerInterceptorTest {
         }
     }
 
-    public  class  Msg extends Message {
+    public class Msg extends Message {
 
         @Override
         public Message copy() {
@@ -126,22 +126,28 @@ public class ActiveMQConsumerInterceptorTest {
 
     @Before
     public void setUp() throws IOException {
+        Config.Agent.ACTIVE_V1_HEADER = true;
         activeMQConsumerInterceptor = new ActiveMQConsumerInterceptor();
         messageDispatch = new MessageDispatch();
 
         Des des = new Des();
         des.setPhysicalName("test");
         messageDispatch.setDestination(des);
-        Message msg =  new Msg();
-        msg.setProperty("sw3","");
+        Message msg = new Msg();
+        msg.setProperty("sw3", "");
         messageDispatch.setMessage(msg);
         arguments = new Object[] {messageDispatch};
         argumentType = null;
     }
 
+    @After
+    public void clear() {
+        Config.Agent.ACTIVE_V1_HEADER = false;
+    }
+
     @Test
     public void testConsumerWithoutMessage() throws Throwable {
-        activeMQConsumerInterceptor.beforeMethod(enhancedInstance,null,arguments,null,null);
+        activeMQConsumerInterceptor.beforeMethod(enhancedInstance, null, arguments, null, null);
         activeMQConsumerInterceptor.afterMethod(enhancedInstance, null, arguments, null, null);
 
         List<TraceSegment> traceSegments = segmentStorage.getTraceSegments();
diff --git a/apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/src/test/java/org/apache/skywalking/apm/plugin/kafka/v11/KafkaConsumerInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/src/test/java/org/apache/skywalking/apm/plugin/kafka/v11/KafkaConsumerInterceptorTest.java
index 3f876bf..4383d08 100644
--- a/apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/src/test/java/org/apache/skywalking/apm/plugin/kafka/v11/KafkaConsumerInterceptorTest.java
+++ b/apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/src/test/java/org/apache/skywalking/apm/plugin/kafka/v11/KafkaConsumerInterceptorTest.java
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 import org.apache.kafka.clients.consumer.ConsumerRecord;
 import org.apache.kafka.common.TopicPartition;
+import org.apache.skywalking.apm.agent.core.conf.Config;
 import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
 import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
 import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
@@ -39,6 +40,7 @@ import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
 import org.apache.skywalking.apm.plugin.kafka.v1.ConsumerEnhanceRequiredInfo;
 import org.apache.skywalking.apm.plugin.kafka.v1.KafkaConsumerInterceptor;
 import org.hamcrest.MatcherAssert;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -78,6 +80,7 @@ public class KafkaConsumerInterceptorTest {
 
     @Before
     public void setUp() {
+        Config.Agent.ACTIVE_V1_HEADER = true;
         consumerInterceptor = new KafkaConsumerInterceptor();
         consumerEnhanceRequiredInfo = new ConsumerEnhanceRequiredInfo();
 
@@ -99,6 +102,11 @@ public class KafkaConsumerInterceptorTest {
         messages.put(topicPartition, records);
     }
 
+    @After
+    public void clear() {
+        Config.Agent.ACTIVE_V1_HEADER = false;
+    }
+
     @Test
     public void testConsumerWithoutMessage() throws Throwable {
         consumerInterceptor.beforeMethod(consumerInstance, null, new Object[0], new Class[0], null);
diff --git a/apm-sniffer/apm-sdk-plugin/sofarpc-plugin/src/test/java/org/apache/skywalking/apm/plugin/sofarpc/SofaRpcProviderInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/sofarpc-plugin/src/test/java/org/apache/skywalking/apm/plugin/sofarpc/SofaRpcProviderInterceptorTest.java
index 4ff2370..b3cabbf 100644
--- a/apm-sniffer/apm-sdk-plugin/sofarpc-plugin/src/test/java/org/apache/skywalking/apm/plugin/sofarpc/SofaRpcProviderInterceptorTest.java
+++ b/apm-sniffer/apm-sdk-plugin/sofarpc-plugin/src/test/java/org/apache/skywalking/apm/plugin/sofarpc/SofaRpcProviderInterceptorTest.java
@@ -40,6 +40,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
 import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
 import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
 import org.hamcrest.CoreMatchers;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -81,17 +82,18 @@ public class SofaRpcProviderInterceptorTest {
     @Mock
     private ProviderInvoker invoker;
 
-    private SofaRequest           sofaRequest = PowerMockito.mock(SofaRequest.class);
+    private SofaRequest sofaRequest = PowerMockito.mock(SofaRequest.class);
     @Mock
     private MethodInterceptResult methodInterceptResult;
 
     private SofaResponse sofaResponse = PowerMockito.mock(SofaResponse.class);
 
     private Object[] allArguments;
-    private Class[]  argumentTypes;
+    private Class[] argumentTypes;
 
     @Before
     public void setUp() throws Exception {
+        Config.Agent.ACTIVE_V1_HEADER = true;
         sofaRpcProviderInterceptor = new SofaRpcProviderInterceptor();
 
         PowerMockito.mockStatic(RpcInternalContext.class);
@@ -111,11 +113,16 @@ public class SofaRpcProviderInterceptorTest {
         Config.Agent.APPLICATION_CODE = "SOFARPC-TestCases-APP";
     }
 
+    @After
+    public void clear() {
+        Config.Agent.ACTIVE_V1_HEADER = false;
+    }
+
     @Test
     public void testProviderWithAttachment() throws Throwable {
         when(rpcContext.isConsumerSide()).thenReturn(false);
         when(sofaRequest.getRequestProp(SKYWALKING_PREFIX + SW3CarrierItem.HEADER_NAME)).thenReturn(
-                "1.323.4433|3|1|1|#192.168.1.8 :18002|#/portal/|#/testEntrySpan|#AQA*#AQA*Et0We0tQNQA*");
+            "1.323.4433|3|1|1|#192.168.1.8 :18002|#/portal/|#/testEntrySpan|#AQA*#AQA*Et0We0tQNQA*");
 
         sofaRpcProviderInterceptor.beforeMethod(enhancedInstance, null, allArguments, argumentTypes, methodInterceptResult);
         sofaRpcProviderInterceptor.afterMethod(enhancedInstance, null, allArguments, argumentTypes, sofaResponse);
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/undertow/v2x/ExecuteRootHandlerInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/undertow/v2x/ExecuteRootHandlerInterceptorTest.java
index 9939425..981d983 100644
--- a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/undertow/v2x/ExecuteRootHandlerInterceptorTest.java
+++ b/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/undertow/v2x/ExecuteRootHandlerInterceptorTest.java
@@ -18,6 +18,7 @@
 
 package org.apache.skywalking.apm.plugin.undertow.v2x;
 
+import org.apache.skywalking.apm.agent.core.conf.Config;
 import org.apache.skywalking.apm.agent.core.context.SW3CarrierItem;
 import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
 import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
@@ -36,6 +37,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
 import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
 import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
 import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
@@ -89,6 +91,7 @@ public class ExecuteRootHandlerInterceptorTest {
 
     @Before
     public void setUp() throws Exception {
+        Config.Agent.ACTIVE_V1_HEADER = true;
         executeRootHandlerInterceptor = new ExecuteRootHandlerInterceptor();
         exchange = new HttpServerExchange(serverConnection, requestHeaders, responseHeaders, 0);
         exchange.setRequestURI("/test/testRequestURL");
@@ -96,8 +99,13 @@ public class ExecuteRootHandlerInterceptorTest {
         exchange.setDestinationAddress(new InetSocketAddress("localhost", 8080));
         exchange.setRequestScheme("http");
         exchange.setRequestMethod(HttpString.tryFromString("POST"));
-        arguments = new Object[]{httpHandler, exchange};
-        argumentType = new Class[]{httpHandler.getClass(), exchange.getClass()};
+        arguments = new Object[] {httpHandler, exchange};
+        argumentType = new Class[] {httpHandler.getClass(), exchange.getClass()};
+    }
+
+    @After
+    public void clear() {
+        Config.Agent.ACTIVE_V1_HEADER = false;
     }
 
     @Test
diff --git a/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/test/java/org/apache/skywalking/apm/toolkit/activation/opentracing/SkywalkingSpanActivationTest.java b/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/test/java/org/apache/skywalking/apm/toolkit/activation/opentracing/SkywalkingSpanActivationTest.java
index f6d700d..fb9d454 100644
--- a/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/test/java/org/apache/skywalking/apm/toolkit/activation/opentracing/SkywalkingSpanActivationTest.java
+++ b/apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/src/test/java/org/apache/skywalking/apm/toolkit/activation/opentracing/SkywalkingSpanActivationTest.java
@@ -16,31 +16,17 @@
  *
  */
 
-
 package org.apache.skywalking.apm.toolkit.activation.opentracing;
 
 import io.opentracing.Tracer;
 import io.opentracing.propagation.Format;
 import io.opentracing.propagation.TextMap;
 import io.opentracing.tag.Tags;
-
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-
-import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
-import org.apache.skywalking.apm.agent.test.tools.SegmentRefAssert;
-import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
-import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
-import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.powermock.modules.junit4.PowerMockRunnerDelegate;
+import org.apache.skywalking.apm.agent.core.conf.Config;
 import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
 import org.apache.skywalking.apm.agent.core.context.SW3CarrierItem;
 import org.apache.skywalking.apm.agent.core.context.ids.ID;
@@ -48,7 +34,12 @@ import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
 import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
 import org.apache.skywalking.apm.agent.core.context.trace.TraceSegmentRef;
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
 import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
+import org.apache.skywalking.apm.agent.test.tools.SegmentRefAssert;
+import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
+import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
+import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
 import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
 import org.apache.skywalking.apm.toolkit.activation.opentracing.continuation.ActivateInterceptor;
 import org.apache.skywalking.apm.toolkit.activation.opentracing.continuation.ConstructorInterceptor;
@@ -62,12 +53,20 @@ import org.apache.skywalking.apm.toolkit.opentracing.SkywalkingContinuation;
 import org.apache.skywalking.apm.toolkit.opentracing.SkywalkingSpan;
 import org.apache.skywalking.apm.toolkit.opentracing.SkywalkingSpanBuilder;
 import org.apache.skywalking.apm.toolkit.opentracing.TextMapContext;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.modules.junit4.PowerMockRunnerDelegate;
 
+import static org.apache.skywalking.apm.agent.test.tools.SpanAssert.assertComponent;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.apache.skywalking.apm.agent.test.tools.SpanAssert.assertComponent;
 
 @RunWith(PowerMockRunner.class)
 @PowerMockRunnerDelegate(TracingSegmentRunner.class)
@@ -106,15 +105,16 @@ public class SkywalkingSpanActivationTest {
 
     @Before
     public void setUp() {
+        Config.Agent.ACTIVE_V1_HEADER = true;
         spanBuilder = new SkywalkingSpanBuilder("test").withTag(Tags.COMPONENT.getKey(), "test");
         constructorWithSpanBuilderInterceptor = new ConstructorWithSpanBuilderInterceptor();
         spanLogInterceptor = new SpanLogInterceptor();
-        logArgument = new Object[]{111111111L, event};
-        logArgumentType = new Class[]{long.class, HashMap.class};
+        logArgument = new Object[] {111111111L, event};
+        logArgumentType = new Class[] {long.class, HashMap.class};
 
         setOperationNameInterceptor = new SpanSetOperationNameInterceptor();
-        setOperationNameArgument = new Object[]{"testOperationName"};
-        setOperationNameArgumentType = new Class[]{String.class};
+        setOperationNameArgument = new Object[] {"testOperationName"};
+        setOperationNameArgumentType = new Class[] {String.class};
 
         spanFinishInterceptor = new SpanFinishInterceptor();
 
@@ -125,6 +125,11 @@ public class SkywalkingSpanActivationTest {
         activateInterceptor = new ActivateInterceptor();
     }
 
+    @After
+    public void clear() {
+        Config.Agent.ACTIVE_V1_HEADER = false;
+    }
+
     @Test
     public void testCreateLocalSpan() throws Throwable {
         startSpan();
@@ -167,7 +172,7 @@ public class SkywalkingSpanActivationTest {
     @Test
     public void testCreateExitSpanWithPeer() throws Throwable {
         spanBuilder.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT)
-                .withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), "8080");
+            .withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), "8080");
         startSpan();
         stopSpan();
 
@@ -189,7 +194,7 @@ public class SkywalkingSpanActivationTest {
     @Test
     public void testInject() throws Throwable {
         spanBuilder.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT)
-                .withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), 8080);
+            .withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), 8080);
         startSpan();
 
         final Map<String, String> values = new HashMap<String, String>();
@@ -207,7 +212,7 @@ public class SkywalkingSpanActivationTest {
         };
 
         injectInterceptor.afterMethod(enhancedInstance, null,
-                new Object[]{new TextMapContext(), Format.Builtin.TEXT_MAP, carrier}, null, null);
+            new Object[] {new TextMapContext(), Format.Builtin.TEXT_MAP, carrier}, null, null);
 
         String[] parts = values.get(SW3CarrierItem.HEADER_NAME).split("\\|", 8);
         Assert.assertEquals("0", parts[1]);
@@ -219,7 +224,7 @@ public class SkywalkingSpanActivationTest {
     @Test
     public void testExtractWithValidateContext() throws Throwable {
         spanBuilder.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT)
-                .withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), 8080);
+            .withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), 8080);
         startSpan();
         final Map<String, String> values = new HashMap<String, String>();
         TextMap carrier = new TextMap() {
@@ -238,7 +243,7 @@ public class SkywalkingSpanActivationTest {
         values.put(SW3CarrierItem.HEADER_NAME, "1.343.222|3|1|1|#127.0.0.1:8080|#/portal/|#/testEntrySpan|434.12.12123");
 
         extractInterceptor.afterMethod(enhancedInstance, null,
-                new Object[]{Format.Builtin.TEXT_MAP, carrier}, new Class[]{}, null);
+            new Object[] {Format.Builtin.TEXT_MAP, carrier}, new Class[] {}, null);
         stopSpan();
 
         TraceSegment tracingSegment = assertTraceSemgnets();
@@ -256,7 +261,7 @@ public class SkywalkingSpanActivationTest {
     @Test
     public void testExtractWithInValidateContext() throws Throwable {
         spanBuilder.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT)
-                .withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), 8080);
+            .withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), 8080);
         startSpan();
 
         final Map<String, String> values = new HashMap<String, String>();
@@ -276,7 +281,7 @@ public class SkywalkingSpanActivationTest {
         values.put(SW3CarrierItem.HEADER_NAME, "aaaaaaaa|3|#192.168.1.8:18002|#/portal/|#/testEntrySpan|1.234.444");
 
         extractInterceptor.afterMethod(enhancedInstance, null,
-                new Object[]{Format.Builtin.TEXT_MAP, carrier}, new Class[]{}, null);
+            new Object[] {Format.Builtin.TEXT_MAP, carrier}, new Class[] {}, null);
         stopSpan();
 
         TraceSegment tracingSegment = assertTraceSemgnets();
@@ -340,11 +345,11 @@ public class SkywalkingSpanActivationTest {
     }
 
     private void startSpan(MockEnhancedInstance enhancedInstance) throws Throwable {
-        constructorWithSpanBuilderInterceptor.onConstruct(enhancedInstance, new Object[]{spanBuilder});
+        constructorWithSpanBuilderInterceptor.onConstruct(enhancedInstance, new Object[] {spanBuilder});
         spanLogInterceptor.afterMethod(enhancedInstance, null, logArgument, logArgumentType, null);
 
         setOperationNameInterceptor.afterMethod(enhancedInstance, SkywalkingSpan.class.getMethod("setOperationName", String.class),
-                setOperationNameArgument, setOperationNameArgumentType, null);
+            setOperationNameArgument, setOperationNameArgumentType, null);
     }
 
     private class MockEnhancedInstance implements EnhancedInstance {