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());
}
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();
}
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");
}
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);
}
Aggregations