Codota Logo
IMethodSensor.getHook
Code IndexAdd Codota to your IDE (free)

How to use
getHook
method
in
rocks.inspectit.agent.java.sensor.method.IMethodSensor

Best Java code snippets using rocks.inspectit.agent.java.sensor.method.IMethodSensor.getHook (Showing top 18 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public Object dispatchSpecialMethodBeforeBody(long id, Object object, Object[] parameters) {
  try {
    SpecialSensorConfig ssc = specialMappings.get(id);
    IMethodSensor methodSensor = ssc.getSensor();
    ISpecialHook specialHook = (ISpecialHook) methodSensor.getHook();
    Object result = specialHook.beforeBody(id, object, parameters, ssc);
    if (null != result) {
      return result;
    }
  } catch (Throwable throwable) { // NOPMD
    log.error("An error happened in the Hook Dispatcher! (before special method)", throwable);
  }
  return null;
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public Object dispatchSpecialMethodAfterBody(long id, Object object, Object[] parameters, Object returnValue) {
  try {
    SpecialSensorConfig ssc = specialMappings.get(id);
    IMethodSensor methodSensor = ssc.getSensor();
    ISpecialHook specialHook = (ISpecialHook) methodSensor.getHook();
    Object result = specialHook.afterBody(id, object, parameters, returnValue, ssc);
    if (null != result) {
      return result;
    }
  } catch (Throwable throwable) { // NOPMD
    log.error("An error happened in the Hook Dispatcher! (after special method)", throwable);
  }
  return null;
}
origin: inspectIT/inspectIT

@Test
public void dispatchOneSpecialHook() {
  long sensorTypeId = 7L;
  IMethodSensor methodSensor = mock(IMethodSensor.class);
  ISpecialHook specialHook = mock(ISpecialHook.class);
  MethodSensorTypeConfig methodSensorConfig = mock(MethodSensorTypeConfig.class);
  when(methodSensor.getHook()).thenReturn(specialHook);
  when(methodSensor.getSensorTypeConfig()).thenReturn(methodSensorConfig);
  when(methodSensorConfig.getId()).thenReturn(sensorTypeId);
  SpecialSensorConfig specialSensorConfig = mock(SpecialSensorConfig.class);
  when(specialSensorConfig.getSensor()).thenReturn(methodSensor);
  int methodId = 3;
  Object object = mock(Object.class);
  Object[] parameters = new Object[0];
  Object returnValue = mock(Object.class);
  hookDispatcher.addMapping(methodId, specialSensorConfig);
  Object result = hookDispatcher.dispatchSpecialMethodBeforeBody(methodId, object, parameters);
  verify(specialSensorConfig, times(1)).getSensor();
  verify(specialHook, times(1)).beforeBody(methodId, object, parameters, specialSensorConfig);
  assertThat(result, is(nullValue()));
  result = hookDispatcher.dispatchSpecialMethodAfterBody(methodId, object, parameters, returnValue);
  verify(specialSensorConfig, times(2)).getSensor();
  verify(specialHook, times(1)).afterBody(methodId, object, parameters, returnValue, specialSensorConfig);
  assertThat(result, is(nullValue()));
  verifyZeroInteractions(object, coreService, returnValue);
  verifyNoMoreInteractions(specialSensorConfig, specialHook);
}
origin: inspectIT/inspectIT

ISpecialHook specialHook = mock(ISpecialHook.class);
MethodSensorTypeConfig methodSensorConfig = mock(MethodSensorTypeConfig.class);
when(methodSensor.getHook()).thenReturn(specialHook);
when(methodSensor.getSensorTypeConfig()).thenReturn(methodSensorConfig);
when(methodSensorConfig.getId()).thenReturn(sensorTypeId);
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

IConstructorHook constructorHook = (IConstructorHook) methodSensor.getHook();
constructorHook.beforeConstructor(id, methodSensor.getSensorTypeConfig().getId(), parameters, rsc);
origin: inspectIT/inspectIT

IMethodHook methodHook = mock(IMethodHook.class);
MethodSensorTypeConfig methodSensorConfig = mock(MethodSensorTypeConfig.class);
when(methodSensor.getHook()).thenReturn(methodHook);
when(methodSensor.getSensorTypeConfig()).thenReturn(methodSensorConfig);
when(methodSensorConfig.getId()).thenReturn(sensorTypeId);
origin: inspectIT/inspectIT

IMethodHook methodHook = (IMethodHook) methodSensor.getHook();
methodHook.beforeBody(id, methodSensor.getSensorTypeConfig().getId(), object, parameters, rsc);
origin: inspectIT/inspectIT

when(methodSensorConfigTwo.getId()).thenReturn(sensorTypeIdTwo);
when(methodSensorConfigThree.getId()).thenReturn(sensorTypeIdThree);
when(methodSensorOne.getHook()).thenReturn(constructorHookOne);
when(methodSensorTwo.getHook()).thenReturn(constructorHookTwo);
when(methodSensorThree.getHook()).thenReturn(constructorHookThree);
when(methodSensorOne.getSensorTypeConfig()).thenReturn(methodSensorConfigOne);
when(methodSensorTwo.getSensorTypeConfig()).thenReturn(methodSensorConfigTwo);
origin: inspectIT/inspectIT

IConstructorHook constructorHook = (IConstructorHook) methodSensor.getHook();
IConstructorHook constructorHook = (IConstructorHook) methodSensor.getHook();
constructorHook.afterConstructor(coreService, id, methodSensor.getSensorTypeConfig().getId(), object, parameters, rsc);
origin: inspectIT/inspectIT

IMethodHook methodHook = (IMethodHook) methodSensor.getHook();
IMethodHook methodHook = (IMethodHook) methodSensor.getHook();
methodHook.secondAfterBody(coreService, id, methodSensor.getSensorTypeConfig().getId(), object, parameters, returnValue, exception, rsc);
origin: inspectIT/inspectIT

when(methodSensorConfigTwo.getId()).thenReturn(sensorTypeIdTwo);
when(methodSensorConfigThree.getId()).thenReturn(sensorTypeIdThree);
when(methodSensorOne.getHook()).thenReturn(methodHookOne);
when(methodSensorTwo.getHook()).thenReturn(methodHookTwo);
when(methodSensorThree.getHook()).thenReturn(methodHookThree);
when(methodSensorOne.getSensorTypeConfig()).thenReturn(methodSensorConfigOne);
when(methodSensorTwo.getSensorTypeConfig()).thenReturn(methodSensorConfigTwo);
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public void dispatchFirstMethodAfterBody(long id, Object object, Object[] parameters, Object returnValue, boolean exception) {
  if (!executionMarker.isActive()) {
    try {
      executionMarker.active();
      try {
        RegisteredSensorConfig rsc = mappings.get(id);
        // Now iterate over all registered sensor types and execute them
        // normal execution (sensor with highest priority first)
        for (IMethodSensor methodSensor : rsc.getMethodSensors()) {
          IMethodHook methodHook = (IMethodHook) methodSensor.getHook();
          methodHook.firstAfterBody(id, methodSensor.getSensorTypeConfig().getId(), object, parameters, returnValue, exception, rsc);
        }
      } catch (Throwable throwable) { // NOPMD
        log.error("An error happened in the Hook Dispatcher! (after body)", throwable);
      }
    } finally {
      executionMarker.deactive();
    }
  }
}
origin: inspectIT/inspectIT

IMethodHook methodHook = mock(IMethodHook.class);
MethodSensorTypeConfig methodSensorConfig = mock(MethodSensorTypeConfig.class);
when(methodSensor.getHook()).thenReturn(methodHook);
when(methodSensor.getSensorTypeConfig()).thenReturn(methodSensorConfig);
when(methodSensorConfig.getId()).thenReturn(methodSensorTypeId);
verify(registeredSensorConfig, times(1)).isStartsInvocation();
verify(registeredSensorConfig, times(1)).getMethodSensorsReverse();
verify(methodSensor, times(1)).getHook();
verify(methodHook, times(1)).beforeBody(methodId, methodSensorTypeId, object, parameters, registeredSensorConfig);
verify(invocHook, times(1)).beforeBody(methodId, invocSensorTypeId, object, parameters, registeredSensorConfig);
verify(registeredSensorConfigTwo, times(1)).isStartsInvocation();
verify(registeredSensorConfigTwo, times(1)).getMethodSensorsReverse();
verify(methodSensor, times(2)).getHook();
verify(methodHook, times(1)).beforeBody(methodIdTwo, methodSensorTypeId, object, parameters, registeredSensorConfigTwo);
verify(invocHook, times(1)).beforeBody(eq(methodIdTwo), anyLong(), eq(object), eq(parameters), eq(registeredSensorConfigTwo));
verify(methodSensor, times(3)).getHook();
verify(methodHook, times(1)).firstAfterBody(methodIdTwo, methodSensorTypeId, object, parameters, returnValue, exception, registeredSensorConfigTwo);
verify(registeredSensorConfigTwo, times(2)).isStartsInvocation();
verify(registeredSensorConfigTwo, times(2)).getMethodSensors();
verify(methodSensor, times(4)).getHook();
verify(methodHook, times(1)).secondAfterBody(invocHook, methodIdTwo, methodSensorTypeId, object, parameters, returnValue, exception, registeredSensorConfigTwo);
verify(invocHook, times(1)).secondAfterBody(eq(coreService), eq(methodIdTwo), anyLong(), eq(object), eq(parameters), eq(returnValue), eq(exception), eq(registeredSensorConfigTwo));
verify(methodSensor, times(5)).getHook();
verify(methodHook, times(1)).firstAfterBody(methodId, methodSensorTypeId, object, parameters, returnValue, false, registeredSensorConfig);
origin: inspectIT/inspectIT

IMethodSensor methodSensor = mock(IMethodSensor.class);
MethodSensorTypeConfig methodSensorConfig = mock(MethodSensorTypeConfig.class);
when(methodSensor.getHook()).thenReturn(constructorHook);
when(methodSensor.getSensorTypeConfig()).thenReturn(methodSensorConfig);
when(methodSensorConfig.getId()).thenReturn(methodSensorTypeId);
verify(registeredSensorConfigTwo, times(1)).isStartsInvocation();
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(2)).isStartsInvocation();
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));
origin: inspectIT/inspectIT

MethodSensorTypeConfig methodSensorConfig = mock(MethodSensorTypeConfig.class);
when(methodSensor.getSensorTypeConfig()).thenReturn(methodSensorConfig);
when(methodSensor.getHook()).thenReturn(methodHook);
when(methodSensorConfig.getId()).thenReturn(sensorTypeId);
origin: inspectIT/inspectIT

when(methodSensorConfigTwo.getId()).thenReturn(sensorTypeIdTwo);
when(methodSensorConfigThree.getId()).thenReturn(sensorTypeIdThree);
when(methodSensorOne.getHook()).thenReturn(methodHookOne);
when(methodSensorTwo.getHook()).thenReturn(methodHookTwo);
when(methodSensorThree.getHook()).thenReturn(methodHookThree);
when(methodSensorOne.getSensorTypeConfig()).thenReturn(methodSensorConfigOne);
when(methodSensorTwo.getSensorTypeConfig()).thenReturn(methodSensorConfigTwo);
origin: inspectIT/inspectIT

MethodSensorTypeConfig methodSensorConfig = mock(MethodSensorTypeConfig.class);
when(methodSensor.getSensorTypeConfig()).thenReturn(methodSensorConfig);
when(methodSensor.getHook()).thenReturn(methodHook);
when(methodSensorConfig.getId()).thenReturn(methodSensorTypeId);
rocks.inspectit.agent.java.sensor.methodIMethodSensorgetHook

Javadoc

Returns the proper method hook.

Popular methods of IMethodSensor

  • getSensorTypeConfig
    Returns the MethodSensorTypeConfig for this sensor.

Popular in Java

  • Reactive rest calls using spring rest template
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Collectors (java.util.stream)
  • JPanel (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now