Search in sources :

Example 66 with InterceptorScopeInvocation

use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation in project pinpoint by naver.

the class DefaultScopeTest method test0.

@Test
public void test0() {
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    assertFalse(transaction.isActive());
    assertFalse(transaction.tryEnter(ExecutionPolicy.INTERNAL));
    assertFalse(transaction.isActive());
    assertTrue(transaction.tryEnter(ExecutionPolicy.BOUNDARY));
    assertTrue(transaction.isActive());
    assertTrue(transaction.tryEnter(ExecutionPolicy.INTERNAL));
    assertTrue(transaction.isActive());
    assertFalse(transaction.tryEnter(ExecutionPolicy.BOUNDARY));
    assertTrue(transaction.isActive());
    assertFalse(transaction.canLeave(ExecutionPolicy.BOUNDARY));
    assertTrue(transaction.isActive());
    assertTrue(transaction.canLeave(ExecutionPolicy.INTERNAL));
    transaction.leave(ExecutionPolicy.INTERNAL);
    assertTrue(transaction.isActive());
    assertTrue(transaction.canLeave(ExecutionPolicy.BOUNDARY));
    assertTrue(transaction.isActive());
    transaction.leave(ExecutionPolicy.BOUNDARY);
    assertFalse(transaction.isActive());
    assertFalse(transaction.canLeave(ExecutionPolicy.INTERNAL));
    assertFalse(transaction.isActive());
}
Also used : DefaultInterceptorScopeInvocation(com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation) InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) DefaultInterceptorScopeInvocation(com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation) Test(org.junit.Test)

Example 67 with InterceptorScopeInvocation

use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation in project pinpoint by naver.

the class DefaultScopeTest method testAttachment.

@Test
public void testAttachment() {
    String attachment = "context";
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    transaction.tryEnter(ExecutionPolicy.ALWAYS);
    assertNull(transaction.getAttachment());
    transaction.setAttachment(attachment);
    assertSame(transaction.getAttachment(), attachment);
    transaction.tryEnter(ExecutionPolicy.ALWAYS);
    assertSame(transaction.getAttachment(), attachment);
    transaction.canLeave(ExecutionPolicy.ALWAYS);
    transaction.leave(ExecutionPolicy.ALWAYS);
    assertSame(transaction.getAttachment(), attachment);
    transaction.canLeave(ExecutionPolicy.ALWAYS);
    transaction.leave(ExecutionPolicy.ALWAYS);
}
Also used : DefaultInterceptorScopeInvocation(com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation) InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) DefaultInterceptorScopeInvocation(com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation) Test(org.junit.Test)

Example 68 with InterceptorScopeInvocation

use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation in project pinpoint by naver.

the class DefaultScopeTest method testAfterWithoutBefore2.

@Test(expected = IllegalStateException.class)
public void testAfterWithoutBefore2() {
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    transaction.leave(ExecutionPolicy.BOUNDARY);
}
Also used : DefaultInterceptorScopeInvocation(com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation) InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) DefaultInterceptorScopeInvocation(com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation) Test(org.junit.Test)

Example 69 with InterceptorScopeInvocation

use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation in project pinpoint by naver.

the class DefaultScopeTest method testRemoveAttachmentFail.

@Test(expected = IllegalStateException.class)
public void testRemoveAttachmentFail() {
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    transaction.removeAttachment();
}
Also used : DefaultInterceptorScopeInvocation(com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation) InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) DefaultInterceptorScopeInvocation(com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation) Test(org.junit.Test)

Example 70 with InterceptorScopeInvocation

use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation in project pinpoint by naver.

the class DefaultScopeTest method testGetAttachmentFail2.

@Test(expected = IllegalStateException.class)
public void testGetAttachmentFail2() {
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    transaction.tryEnter(ExecutionPolicy.ALWAYS);
    transaction.canLeave(ExecutionPolicy.ALWAYS);
    transaction.leave(ExecutionPolicy.ALWAYS);
    transaction.getAttachment();
}
Also used : DefaultInterceptorScopeInvocation(com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation) InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) DefaultInterceptorScopeInvocation(com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation) Test(org.junit.Test)

Aggregations

InterceptorScopeInvocation (com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation)71 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)27 Test (org.junit.Test)20 SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)15 DefaultInterceptorScopeInvocation (com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation)15 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)9 ThriftClientCallContext (com.navercorp.pinpoint.plugin.thrift.ThriftClientCallContext)8 HttpCallContext (com.navercorp.pinpoint.plugin.httpclient4.HttpCallContext)7 DefaultInterceptorScopeDefinition (com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition)6 AttachmentFactory (com.navercorp.pinpoint.bootstrap.interceptor.scope.AttachmentFactory)5 Request (com.squareup.okhttp.Request)5 CommandContext (com.navercorp.pinpoint.plugin.redis.CommandContext)4 ThriftRequestProperty (com.navercorp.pinpoint.plugin.thrift.ThriftRequestProperty)4 ServerMarkerFlagFieldAccessor (com.navercorp.pinpoint.plugin.thrift.field.accessor.ServerMarkerFlagFieldAccessor)4 HttpClient3CallContext (com.navercorp.pinpoint.plugin.httpclient3.HttpClient3CallContext)3 CommandContext (com.navercorp.pinpoint.plugin.redis.jedis.CommandContext)3 Request (okhttp3.Request)3 AsyncContext (com.navercorp.pinpoint.bootstrap.context.AsyncContext)2 EndPointAccessor (com.navercorp.pinpoint.plugin.redis.EndPointAccessor)2 HttpRequest (org.apache.http.HttpRequest)2