Tabnine Logo
IConstructorHook
Code IndexAdd Tabnine to your IDE (free)

How to use
IConstructorHook
in
rocks.inspectit.agent.java.hooking

Best Java code snippets using rocks.inspectit.agent.java.hooking.IConstructorHook (Showing top 5 results out of 315)

origin: inspectIT/inspectIT

@Test
public void dispatchOneConstructorHookWithoutInvocationTrace() {
  long sensorTypeId = 7L;
  IConstructorHook constructorHook = mock(IConstructorHook.class);
  IMethodSensor methodSensor = mock(IMethodSensor.class);
  MethodSensorTypeConfig methodSensorConfig = mock(MethodSensorTypeConfig.class);
  when(methodSensor.getHook()).thenReturn(constructorHook);
  when(methodSensor.getSensorTypeConfig()).thenReturn(methodSensorConfig);
  when(methodSensorConfig.getId()).thenReturn(sensorTypeId);
  RegisteredSensorConfig registeredSensorConfig = mock(RegisteredSensorConfig.class);
  when(registeredSensorConfig.getMethodSensors()).thenReturn(Collections.singletonList(methodSensor));
  when(registeredSensorConfig.getMethodSensorsReverse()).thenReturn(Collections.singletonList(methodSensor));
  int methodId = 3;
  Object object = mock(Object.class);
  Object[] parameters = new Object[0];
  hookDispatcher.addMapping(methodId, registeredSensorConfig);
  hookDispatcher.dispatchConstructorBeforeBody(methodId, parameters);
  verify(registeredSensorConfig, times(1)).isStartsInvocation();
  verify(registeredSensorConfig, times(1)).getMethodSensorsReverse();
  verify(constructorHook, times(1)).beforeConstructor(methodId, sensorTypeId, parameters, registeredSensorConfig);
  hookDispatcher.dispatchConstructorAfterBody(methodId, object, parameters);
  verify(registeredSensorConfig, times(2)).isStartsInvocation();
  verify(registeredSensorConfig, times(1)).getMethodSensors();
  verify(constructorHook, times(1)).afterConstructor(coreService, methodId, sensorTypeId, object, parameters, registeredSensorConfig);
  verifyZeroInteractions(object, coreService);
  verifyNoMoreInteractions(registeredSensorConfig, constructorHook);
}
origin: inspectIT/inspectIT

    constructorHook.afterConstructor(coreService, id, sensorId, object, parameters, rsc);
  } else {
    constructorHook.afterConstructor(invocCoreService, id, sensorId, object, parameters, rsc);
for (IMethodSensor methodSensor : rsc.getMethodSensors()) {
  IConstructorHook constructorHook = (IConstructorHook) methodSensor.getHook();
  constructorHook.afterConstructor(coreService, id, methodSensor.getSensorTypeConfig().getId(), object, parameters, rsc);
invocationHook.afterConstructor(coreService, id, -1, object, parameters, rsc);
origin: inspectIT/inspectIT

invocationHook.beforeConstructor(id, -1, parameters, rsc);
constructorHook.beforeConstructor(id, methodSensor.getSensorTypeConfig().getId(), parameters, rsc);
origin: inspectIT/inspectIT

verify(registeredSensorConfig, times(1)).getMethodSensorsReverse();
InOrder inOrder = inOrder(constructorHookOne, constructorHookTwo, constructorHookThree);
inOrder.verify(constructorHookThree, times(1)).beforeConstructor(methodId, sensorTypeIdThree, parameters, registeredSensorConfig);
inOrder.verify(constructorHookTwo, times(1)).beforeConstructor(methodId, sensorTypeIdTwo, parameters, registeredSensorConfig);
inOrder.verify(constructorHookOne, times(1)).beforeConstructor(methodId, sensorTypeIdOne, parameters, registeredSensorConfig);
verify(registeredSensorConfig, times(1)).getMethodSensors();
inOrder = inOrder(constructorHookOne, constructorHookTwo, constructorHookThree);
inOrder.verify(constructorHookOne, times(1)).afterConstructor(coreService, methodId, sensorTypeIdOne, object, parameters, registeredSensorConfig);
inOrder.verify(constructorHookTwo, times(1)).afterConstructor(coreService, methodId, sensorTypeIdTwo, object, parameters, registeredSensorConfig);
inOrder.verify(constructorHookThree, times(1)).afterConstructor(coreService, methodId, sensorTypeIdThree, object, parameters, registeredSensorConfig);
origin: inspectIT/inspectIT

verify(registeredSensorConfigTwo, times(1)).getMethodSensorsReverse();
verify(methodSensor, times(1)).getHook();
verify(constructorHook, times(1)).beforeConstructor(methodIdTwo, methodSensorTypeId, parameters, registeredSensorConfigTwo);
verify((IConstructorHook) invocHook, times(1)).beforeConstructor(eq(methodIdTwo), anyLong(), eq(parameters), eq(registeredSensorConfigTwo));
verify(registeredSensorConfigTwo, times(1)).getMethodSensors();
verify(methodSensor, times(2)).getHook();
verify(constructorHook, times(1)).afterConstructor(invocHook, methodIdTwo, methodSensorTypeId, object, parameters, registeredSensorConfigTwo);
verify((IConstructorHook) invocHook, times(1)).afterConstructor(eq(coreService), eq(methodIdTwo), anyLong(), eq(object), eq(parameters), eq(registeredSensorConfigTwo));
rocks.inspectit.agent.java.hookingIConstructorHook

Javadoc

Classes which add a hook into a constructor have to implement this interface.

Most used methods

  • afterConstructor
    The bytecode is inserted after the constructor calls.
  • beforeConstructor
    The bytecode is inserted before a constructor in the super class or this class is called. Therefore,

Popular in Java

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • findViewById (Activity)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • JComboBox (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now