Search in sources :

Example 11 with DefaultInterceptorScopeInvocation

use of com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation 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 12 with DefaultInterceptorScopeInvocation

use of com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation 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)

Example 13 with DefaultInterceptorScopeInvocation

use of com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation in project pinpoint by naver.

the class DefaultScopeTest method testSetAttachmentFail.

@Test(expected = IllegalStateException.class)
public void testSetAttachmentFail() {
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    transaction.setAttachment("attachment");
}
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 14 with DefaultInterceptorScopeInvocation

use of com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation 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)

Aggregations

InterceptorScopeInvocation (com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation)14 DefaultInterceptorScopeInvocation (com.navercorp.pinpoint.profiler.interceptor.scope.DefaultInterceptorScopeInvocation)14 Test (org.junit.Test)14