Search in sources :

Example 1 with DefaultInterceptorScopeInvocation

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

the class DefaultScopeTest method testRemoveAttachmentFail2.

@Test(expected = IllegalStateException.class)
public void testRemoveAttachmentFail2() {
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    transaction.tryEnter(ExecutionPolicy.ALWAYS);
    transaction.canLeave(ExecutionPolicy.ALWAYS);
    transaction.leave(ExecutionPolicy.ALWAYS);
    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 2 with DefaultInterceptorScopeInvocation

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

the class DefaultScopeTest method test1.

@Test
public void test1() {
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    assertFalse(transaction.isActive());
    assertTrue(transaction.tryEnter(ExecutionPolicy.ALWAYS));
    assertTrue(transaction.isActive());
    assertTrue(transaction.tryEnter(ExecutionPolicy.ALWAYS));
    assertTrue(transaction.isActive());
    assertTrue(transaction.canLeave(ExecutionPolicy.ALWAYS));
    assertTrue(transaction.isActive());
    transaction.leave(ExecutionPolicy.ALWAYS);
    assertTrue(transaction.isActive());
    assertTrue(transaction.canLeave(ExecutionPolicy.ALWAYS));
    assertTrue(transaction.isActive());
    transaction.leave(ExecutionPolicy.ALWAYS);
    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 3 with DefaultInterceptorScopeInvocation

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

the class DefaultScopeTest method testAttachment2.

@Test
public void testAttachment2() {
    String attachment = "context";
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    transaction.tryEnter(ExecutionPolicy.ALWAYS);
    assertNull(transaction.getAttachment());
    transaction.setAttachment(attachment);
    transaction.canLeave(ExecutionPolicy.ALWAYS);
    transaction.leave(ExecutionPolicy.ALWAYS);
    transaction.tryEnter(ExecutionPolicy.ALWAYS);
    assertNull(transaction.getAttachment());
    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 4 with DefaultInterceptorScopeInvocation

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

the class DefaultScopeTest method testAttachment3.

@Test
public void testAttachment3() {
    String oldAttachment = "context";
    String newAttachment = "newnew";
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    transaction.tryEnter(ExecutionPolicy.ALWAYS);
    transaction.setAttachment(oldAttachment);
    assertSame(oldAttachment, transaction.getAttachment());
    assertSame(oldAttachment, transaction.setAttachment(newAttachment));
    assertSame(newAttachment, transaction.getAttachment());
    assertSame(newAttachment, transaction.removeAttachment());
    assertNull(transaction.getAttachment());
    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 5 with DefaultInterceptorScopeInvocation

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

the class DefaultScopeTest method testAfterWithoutBefore3.

@Test(expected = IllegalStateException.class)
public void testAfterWithoutBefore3() {
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
    transaction.leave(ExecutionPolicy.INTERNAL);
}
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