use of com.navercorp.pinpoint.profiler.instrument.interceptor.InterceptorDefinitionFactory in project pinpoint by naver.
the class ASMMethodVariablesTest method getInterceptorParameterCount.
@Test
public void getInterceptorParameterCount() throws Exception {
MethodNode methodNode = ASMClassNodeLoader.get("com.navercorp.pinpoint.profiler.instrument.mock.ConstructorChildClass", "<init>");
ASMMethodVariables variables = new ASMMethodVariables("com/navercorp/pinpoint/profiler/instrument/mock/ConstructorChildClass", methodNode);
assertEquals(1, variables.getInterceptorParameterCount(new InterceptorDefinitionFactory().createInterceptorDefinition(ArgsArrayInterceptor.class)));
assertEquals(4, variables.getInterceptorParameterCount(new InterceptorDefinitionFactory().createInterceptorDefinition(StaticInterceptor.class)));
assertEquals(2, variables.getInterceptorParameterCount(new InterceptorDefinitionFactory().createInterceptorDefinition(ApiIdAwareInterceptor.class)));
assertEquals(5, variables.getInterceptorParameterCount(new InterceptorDefinitionFactory().createInterceptorDefinition(BasicInterceptor.class)));
}
use of com.navercorp.pinpoint.profiler.instrument.interceptor.InterceptorDefinitionFactory in project pinpoint by naver.
the class ASMMethodNodeAdapterTest method isVisited.
@Test
public void isVisited() throws Exception {
// init
final int interceptorId = interceptorRegistryBinder.getInterceptorRegistryAdaptor().addInterceptor(new ArgsArrayInterceptor());
final InterceptorDefinition interceptorDefinition = new InterceptorDefinitionFactory().createInterceptorDefinition(ArgsArrayInterceptor.class);
final String targetClassName = "com.navercorp.pinpoint.profiler.instrument.mock.ArgsClass";
final MethodNode methodNode = ASMClassNodeLoader.get(targetClassName, "arg");
ASMMethodNodeAdapter adapter = new ASMMethodNodeAdapter(JavaAssistUtils.javaNameToJvmName(targetClassName), methodNode);
assertEquals(false, adapter.hasInterceptor());
adapter.addBeforeInterceptor(interceptorId, interceptorDefinition, -1);
assertEquals(true, adapter.hasInterceptor());
}
Aggregations