use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation in project pinpoint by naver.
the class ThreadLocalScopePoolTest method testGetOrCreate.
@Test
public void testGetOrCreate() {
ScopePool pool = new ThreadLocalScopePool();
InterceptorScopeInvocation scope = pool.getScope(new DefaultInterceptorScopeDefinition("test"));
scope.tryEnter(ExecutionPolicy.BOUNDARY);
scope.tryEnter(ExecutionPolicy.BOUNDARY);
Assert.assertNull(scope.getAttachment());
Assert.assertEquals(scope.getOrCreateAttachment(new AttachmentFactory() {
@Override
public Object createAttachment() {
return "test";
}
}), "test");
scope.canLeave(ExecutionPolicy.BOUNDARY);
Assert.assertEquals(scope.getAttachment(), "test");
Assert.assertTrue(scope.canLeave(ExecutionPolicy.BOUNDARY));
scope.leave(ExecutionPolicy.BOUNDARY);
Assert.assertEquals("name", "test", scope.getName());
}
use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation in project pinpoint by naver.
the class ThreadLocalScopePoolTest method testGetScope.
@Test
public void testGetScope() {
ScopePool pool = new ThreadLocalScopePool();
InterceptorScopeInvocation scope = pool.getScope(new DefaultInterceptorScopeDefinition("test"));
Assert.assertTrue(scope instanceof ThreadLocalScope);
Assert.assertEquals("name", "test", scope.getName());
}
use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation in project pinpoint by naver.
the class DefaultScopeTest method testAfterWithoutBefore.
@Test(expected = IllegalStateException.class)
public void testAfterWithoutBefore() {
InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
transaction.leave(ExecutionPolicy.ALWAYS);
}
use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation 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.bootstrap.interceptor.scope.InterceptorScopeInvocation in project pinpoint by naver.
the class DefaultScopeTest method testGetAttachmentFail.
@Test(expected = IllegalStateException.class)
public void testGetAttachmentFail() {
InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
transaction.getAttachment();
}
Aggregations