Search in sources :

Example 11 with AnnotatedInterceptorFactory

use of com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory in project pinpoint by naver.

the class AnnotatedInterceptorFactoryTest method test0.

@Test
public void test0() throws Exception {
    AnnotatedInterceptorFactory factory = newAnnotatedInterceptorFactory();
    Interceptor interceptor = factory.getInterceptor(getClass().getClassLoader(), TestInterceptor0.class.getName(), null, null, null, instrumentClass, instrumentMethod);
    assertEquals(TestInterceptor0.class, interceptor.getClass());
}
Also used : TestInterceptor0(com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor0) Interceptor(com.navercorp.pinpoint.bootstrap.interceptor.Interceptor) AnnotatedInterceptorFactory(com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory) Test(org.junit.Test)

Example 12 with AnnotatedInterceptorFactory

use of com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory in project pinpoint by naver.

the class AnnotatedInterceptorFactoryTest method test7.

@Test(expected = PinpointException.class)
public void test7() throws Exception {
    AnnotatedInterceptorFactory factory = newAnnotatedInterceptorFactory();
    factory.getInterceptor(getClass().getClassLoader(), TestInterceptor1.class.getName(), null, null, null, instrumentClass, instrumentMethod);
}
Also used : TestInterceptor1(com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor1) AnnotatedInterceptorFactory(com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory) Test(org.junit.Test)

Example 13 with AnnotatedInterceptorFactory

use of com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory in project pinpoint by naver.

the class AnnotatedInterceptorFactoryTest method test6.

@Test
public void test6() throws Exception {
    Object[] args = new Object[] { (float) 3.0, (short) 2, (byte) 1, "arg0" };
    AnnotatedInterceptorFactory factory = newAnnotatedInterceptorFactory();
    Interceptor interceptor = factory.getInterceptor(getClass().getClassLoader(), TestInterceptor1.class.getName(), args, null, null, instrumentClass, instrumentMethod);
    assertEquals(TestInterceptor1.class, interceptor.getClass());
    assertEquals(args[3], getField(interceptor, "field0"));
    assertEquals(args[2], getField(interceptor, "field1"));
    assertEquals(args[1], getField(interceptor, "field2"));
    assertEquals(args[0], getField(interceptor, "field3"));
}
Also used : TestInterceptor1(com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor1) Interceptor(com.navercorp.pinpoint.bootstrap.interceptor.Interceptor) AnnotatedInterceptorFactory(com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory) Test(org.junit.Test)

Example 14 with AnnotatedInterceptorFactory

use of com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory in project pinpoint by naver.

the class AnnotatedInterceptorFactoryTest method test10.

@Test
public void test10() throws Exception {
    Object[] args = new Object[] { "arg0", 1, 2.0 };
    AnnotatedInterceptorFactory factory = newAnnotatedInterceptorFactory();
    Interceptor interceptor = factory.getInterceptor(getClass().getClassLoader(), TestInterceptor2.class.getName(), args, null, null, instrumentClass, instrumentMethod);
    assertEquals(TestInterceptor2.class, interceptor.getClass());
    assertEquals(args[0], getField(interceptor, "field0"));
    assertEquals(args[1], getField(interceptor, "field1"));
    assertEquals(args[2], getField(interceptor, "field2"));
    assertEquals(false, getField(interceptor, "field3"));
    assertEquals(0L, getField(interceptor, "field4"));
    assertSame(descriptor, getField(interceptor, "descriptor"));
    assertSame(instrumentClass, getField(interceptor, "targetClass"));
    assertSame(instrumentMethod, getField(interceptor, "targetMethod"));
}
Also used : TestInterceptor2(com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor2) Interceptor(com.navercorp.pinpoint.bootstrap.interceptor.Interceptor) AnnotatedInterceptorFactory(com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory) Test(org.junit.Test)

Example 15 with AnnotatedInterceptorFactory

use of com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory in project pinpoint by naver.

the class AnnotatedInterceptorFactoryTest method test1.

@Test
public void test1() throws Exception {
    Object[] args = new Object[] { "arg0" };
    AnnotatedInterceptorFactory factory = newAnnotatedInterceptorFactory();
    Interceptor interceptor = factory.getInterceptor(getClass().getClassLoader(), TestInterceptor0.class.getName(), args, null, null, instrumentClass, instrumentMethod);
    assertEquals(TestInterceptor0.class, interceptor.getClass());
    assertEquals(args[0], getField(interceptor, "field0"));
}
Also used : TestInterceptor0(com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor0) Interceptor(com.navercorp.pinpoint.bootstrap.interceptor.Interceptor) AnnotatedInterceptorFactory(com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory) Test(org.junit.Test)

Aggregations

AnnotatedInterceptorFactory (com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory)18 Test (org.junit.Test)15 Interceptor (com.navercorp.pinpoint.bootstrap.interceptor.Interceptor)14 TestInterceptor1 (com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor1)6 TestInterceptor2 (com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor2)5 TestInterceptor0 (com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor0)4 TraceContext (com.navercorp.pinpoint.bootstrap.context.TraceContext)1 ApiMetaDataService (com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService)1