package com.a.eye.skywalking.api.context;

import com.a.eye.skywalking.trace.Span;
import com.a.eye.skywalking.trace.TraceSegment;
import com.a.eye.skywalking.trace.tag.Tags;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;

/**
 * Created by wusheng on 2017/2/19.
 */
public class ContextManagerTestCase {
    @Test
    public void testDelegateToTracerContext(){
        Span span = ContextManager.createSpan("serviceA");
        Tags.COMPONENT.set(span, "test");

        Assert.assertEquals(span, ContextManager.activeSpan());

        TracerContext.ListenerManager.add(TestTracerContextListener.INSTANCE);
        ContextManager.stopSpan();

        TraceSegment segment = TestTracerContextListener.INSTANCE.finishedSegmentCarrier[0];

        Assert.assertEquals(span, segment.getSpans().get(0));
    }

    @After
    public void reset(){
        TracerContext.ListenerManager.remove(TestTracerContextListener.INSTANCE);
    }
}

@@ -36,16 +36,69 @@
 ntext;%0A%0A
+import com.a.eye.skywalking.api.boot.ServiceManager;%0A
 import c
@@ -129,16 +129,16 @@
 e.Span;%0A
-
 import c
@@ -270,16 +270,46 @@
 Assert;%0A
+import org.junit.BeforeClass;%0A
 import o
@@ -368,16 +368,16 @@
 19.%0A */%0A
-
 public c
@@ -406,16 +406,112 @@
 tCase %7B%0A
+    @BeforeClass%0A    public static void setup()%7B%0A        ServiceManager.INSTANCE.boot();%0A    %7D%0A%0A
     @Tes

Fix CI issue.