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