Search in sources :

Example 1 with DefaultInterceptorScopeDefinition

use of com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition in project pinpoint by naver.

the class ThreadLocalScopeTest method getName.

@Test
public void getName() {
    InterceptorScopeInvocation scope = new ThreadLocalScope(new DefaultInterceptorScopeDefinition("test"));
    Assert.assertEquals(scope.getName(), "test");
}
Also used : InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) DefaultInterceptorScopeDefinition(com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition) Test(org.junit.Test)

Example 2 with DefaultInterceptorScopeDefinition

use of com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition in project pinpoint by naver.

the class ThreadLocalScopeTest method pushPopError.

@Test(expected = IllegalStateException.class)
public void pushPopError() {
    InterceptorScopeInvocation scope = new ThreadLocalScope(new DefaultInterceptorScopeDefinition("test"));
    scope.leave(ExecutionPolicy.BOUNDARY);
}
Also used : InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) DefaultInterceptorScopeDefinition(com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition) Test(org.junit.Test)

Example 3 with DefaultInterceptorScopeDefinition

use of com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition in project pinpoint by naver.

the class ThreadLocalScopeTest method pushPop.

@Test
public void pushPop() {
    InterceptorScopeInvocation scope = new ThreadLocalScope(new DefaultInterceptorScopeDefinition("test"));
    Assert.assertTrue(scope.tryEnter(ExecutionPolicy.BOUNDARY));
    Assert.assertFalse(scope.tryEnter(ExecutionPolicy.BOUNDARY));
    Assert.assertFalse(scope.tryEnter(ExecutionPolicy.BOUNDARY));
    Assert.assertTrue(scope.isActive());
    Assert.assertFalse(scope.canLeave(ExecutionPolicy.BOUNDARY));
    Assert.assertFalse(scope.canLeave(ExecutionPolicy.BOUNDARY));
    Assert.assertTrue(scope.canLeave(ExecutionPolicy.BOUNDARY));
    scope.leave(ExecutionPolicy.BOUNDARY);
}
Also used : InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) DefaultInterceptorScopeDefinition(com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition) Test(org.junit.Test)

Example 4 with DefaultInterceptorScopeDefinition

use of com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition in project pinpoint by naver.

the class ThreadLocalScopePoolTest method testAttachment.

@Test
public void testAttachment() throws Exception {
    ScopePool pool = new ThreadLocalScopePool();
    InterceptorScopeInvocation scope = pool.getScope(new DefaultInterceptorScopeDefinition("test"));
    scope.tryEnter(ExecutionPolicy.BOUNDARY);
    scope.tryEnter(ExecutionPolicy.BOUNDARY);
    Assert.assertNull(scope.getAttachment());
    scope.setAttachment("test");
    scope.canLeave(ExecutionPolicy.BOUNDARY);
    Assert.assertEquals(scope.getAttachment(), "test");
    Assert.assertTrue(scope.canLeave(ExecutionPolicy.BOUNDARY));
    scope.leave(ExecutionPolicy.BOUNDARY);
    Assert.assertEquals("name", scope.getName(), "test");
}
Also used : InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) DefaultInterceptorScopeDefinition(com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition) Test(org.junit.Test)

Example 5 with DefaultInterceptorScopeDefinition

use of com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition in project pinpoint by naver.

the class ThreadLocalScopePoolTest method testGetScope.

@Test
public void testGetScope() throws Exception {
    ScopePool pool = new ThreadLocalScopePool();
    InterceptorScopeInvocation scope = pool.getScope(new DefaultInterceptorScopeDefinition("test"));
    Assert.assertTrue(scope instanceof ThreadLocalScope);
    Assert.assertEquals("name", scope.getName(), "test");
}
Also used : InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) DefaultInterceptorScopeDefinition(com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition) Test(org.junit.Test)

Aggregations

DefaultInterceptorScopeDefinition (com.navercorp.pinpoint.bootstrap.instrument.DefaultInterceptorScopeDefinition)6 InterceptorScopeInvocation (com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation)6 Test (org.junit.Test)6 AttachmentFactory (com.navercorp.pinpoint.bootstrap.interceptor.scope.AttachmentFactory)1