use of com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder in project pinpoint by naver.
the class JavassistEngineTest method newJavassistEngine.
private InstrumentEngine newJavassistEngine() {
Instrumentation instrumentation = mock(Instrumentation.class);
ObjectBinderFactory objectBinderFactory = mock(ObjectBinderFactory.class);
Provider<ApiMetaDataService> apiMetaDataService = Providers.of(mock(ApiMetaDataService.class));
InterceptorRegistryBinder binder = new TestInterceptorRegistryBinder();
return new JavassistEngine(instrumentation, objectBinderFactory, binder, apiMetaDataService, null);
}
use of com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder in project pinpoint by naver.
the class ASMMethodVariablesTest method initInterceptorLocalVariables.
@Test
public void initInterceptorLocalVariables() 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);
assertNull(variables.getEnterInsnNode());
assertNull(variables.getEnterInsnNode());
InterceptorRegistryBinder interceptorRegistryBinder = new DefaultInterceptorRegistryBinder();
int interceptorId = interceptorRegistryBinder.getInterceptorRegistryAdaptor().addInterceptor(new ArgsArrayInterceptor());
final InterceptorDefinition interceptorDefinition = new InterceptorDefinitionFactory().createInterceptorDefinition(ArgsArrayInterceptor.class);
InsnList instructions = new InsnList();
boolean first = variables.initInterceptorLocalVariables(instructions, interceptorId, interceptorDefinition, -1);
assertEquals(true, first);
assertNotNull(variables.getEnterInsnNode());
assertNotNull(variables.getEnterInsnNode());
}
use of com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder in project pinpoint by naver.
the class ASMMethodVariablesTest method hasInterceptor.
@Test
public void hasInterceptor() throws Exception {
InterceptorRegistryBinder interceptorRegistryBinder = new DefaultInterceptorRegistryBinder();
int interceptorId = interceptorRegistryBinder.getInterceptorRegistryAdaptor().addInterceptor(new ArgsArrayInterceptor());
final InterceptorDefinition interceptorDefinition = new InterceptorDefinitionFactory().createInterceptorDefinition(ArgsArrayInterceptor.class);
final ClassNode classNode = ASMClassNodeLoader.get("com.navercorp.pinpoint.profiler.instrument.mock.ArgsClass");
List<MethodNode> methodNodes = classNode.methods;
for (MethodNode methodNode : methodNodes) {
ASMMethodNodeAdapter methodNodeAdapter = new ASMMethodNodeAdapter(classNode.name, methodNode);
assertEquals(false, methodNodeAdapter.hasInterceptor());
methodNodeAdapter.addBeforeInterceptor(interceptorId, interceptorDefinition, -1);
assertEquals(true, methodNodeAdapter.hasInterceptor());
}
}
use of com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder in project pinpoint by naver.
the class DependencyGraph method newApplicationContext.
private DefaultApplicationContext newApplicationContext() {
ProfilerConfig profilerConfig = new DefaultProfilerConfig();
InterceptorRegistryBinder binder = new TestInterceptorRegistryBinder();
Instrumentation instrumentation = mock(Instrumentation.class);
AgentOption agentOption = new DefaultAgentOption(instrumentation, "mockAgent", "mockApplicationName", profilerConfig, new URL[0], null, new DefaultServiceTypeRegistryService(), new DefaultAnnotationKeyRegistryService());
return new DefaultApplicationContext(agentOption, binder);
}
Aggregations