if (!methodType.getReturnType().getClassName().equals(instrumentationConfig.getReturnType())) { return false;
protected void prepareConfigurationMockConstructor(MethodInstrumentationConfig point, Class<?> clazz, boolean staticConstructor, Class<?>... parameterTypes) throws SecurityException, NoSuchMethodException { clazz.getDeclaredConstructor(parameterTypes); when(point.getTargetClassFqn()).thenReturn(clazz.getName()); when(point.getTargetMethodName()).thenReturn(staticConstructor ? "<clinit>" : "<init>"); when(point.getReturnType()).thenReturn("void"); if (ArrayUtils.isNotEmpty(parameterTypes)) { List<String> params = new ArrayList<String>(); for (Class<?> paramType : parameterTypes) { if (paramType.isArray()) { params.add(paramType.getComponentType().getName() + "[]"); } else { params.add(paramType.getName()); } } when(point.getParameterTypes()).thenReturn(params); } }
protected void prepareConfigurationMockMethod(MethodInstrumentationConfig point, Class<?> clazz, String methodName, Class<?>... parameterTypes) throws SecurityException, NoSuchMethodException { Method method = clazz.getDeclaredMethod(methodName, parameterTypes); when(point.getTargetClassFqn()).thenReturn(clazz.getName()); when(point.getTargetMethodName()).thenReturn(methodName); if (method.getReturnType().isArray()) { when(point.getReturnType()).thenReturn(method.getReturnType().getComponentType().getName() + "[]"); } else { when(point.getReturnType()).thenReturn(method.getReturnType().getName()); } if (ArrayUtils.isNotEmpty(parameterTypes)) { List<String> params = new ArrayList<String>(); for (Class<?> paramType : parameterTypes) { if (paramType.isArray()) { params.add(paramType.getComponentType().getName() + "[]"); } else { params.add(paramType.getName()); } } when(point.getParameterTypes()).thenReturn(params); } }
when(methodInstrumentationConfig.getReturnType()).thenReturn("void"); when(methodInstrumentationConfig.getAllInstrumentationPoints()).thenReturn(Collections.<IMethodInstrumentationPoint> singleton(specialInstrumentationPoint)); when(methodInstrumentationConfig.getSpecialInstrumentationPoint()).thenReturn(specialInstrumentationPoint); assertThat(sscCaptor.getValue().getTargetClassFqn(), is(methodInstrumentationConfig.getTargetClassFqn())); assertThat(sscCaptor.getValue().getTargetMethodName(), is(methodInstrumentationConfig.getTargetMethodName())); assertThat(sscCaptor.getValue().getReturnType(), is(methodInstrumentationConfig.getReturnType())); verifyNoMoreInteractions(hookDispatcherMapper, connection, classHashHelper);
when(methodInstrumentationConfig.getReturnType()).thenReturn("void"); when(methodInstrumentationConfig.getSensorInstrumentationPoint()).thenReturn(sensorInstrumentationPoint); when(methodInstrumentationConfig.getAllInstrumentationPoints()).thenReturn(Collections.<IMethodInstrumentationPoint> singleton(sensorInstrumentationPoint));
when(methodInstrumentationConfig.getReturnType()).thenReturn("void"); when(methodInstrumentationConfig.getParameterTypes()).thenReturn(Collections.<String> emptyList()); when(methodInstrumentationConfig.getSensorInstrumentationPoint()).thenReturn(sensorInstrumentationPoint);
when(methodInstrumentationConfig.getReturnType()).thenReturn("void"); when(methodInstrumentationConfig.getParameterTypes()).thenReturn(Collections.<String> emptyList()); when(methodInstrumentationConfig.getSensorInstrumentationPoint()).thenReturn(sensorInstrumentationPoint); assertThat(rscCaptor.getValue().getTargetClassFqn(), is(methodInstrumentationConfig.getTargetClassFqn())); assertThat(rscCaptor.getValue().getTargetMethodName(), is(methodInstrumentationConfig.getTargetMethodName())); assertThat(rscCaptor.getValue().getReturnType(), is(methodInstrumentationConfig.getReturnType())); assertThat(rscCaptor.getValue().isStartsInvocation(), is(sensorInstrumentationPoint.isStartsInvocation())); assertThat(rscCaptor.getValue().getSettings(), is(sensorInstrumentationPoint.getSettings()));
when(methodInstrumentationConfig.getReturnType()).thenReturn("void"); when(methodInstrumentationConfig.getParameterTypes()).thenReturn(Collections.<String> emptyList()); when(methodInstrumentationConfig.getSensorInstrumentationPoint()).thenReturn(sensorInstrumentationPoint); assertThat(rscCaptor.getValue().getTargetClassFqn(), is(methodInstrumentationConfig.getTargetClassFqn())); assertThat(rscCaptor.getValue().getTargetMethodName(), is(methodInstrumentationConfig.getTargetMethodName())); assertThat(rscCaptor.getValue().getReturnType(), is(methodInstrumentationConfig.getReturnType())); assertThat(rscCaptor.getValue().isStartsInvocation(), is(sensorInstrumentationPoint.isStartsInvocation())); assertThat(rscCaptor.getValue().getSettings(), is(sensorInstrumentationPoint.getSettings()));
when(methodInstrumentationConfig.getReturnType()).thenReturn("void"); when(methodInstrumentationConfig.getParameterTypes()).thenReturn(Collections.<String> emptyList()); when(methodInstrumentationConfig.getSensorInstrumentationPoint()).thenReturn(sensorInstrumentationPoint); assertThat(rscCaptor.getValue().getTargetClassFqn(), is(methodInstrumentationConfig.getTargetClassFqn())); assertThat(rscCaptor.getValue().getTargetMethodName(), is(methodInstrumentationConfig.getTargetMethodName())); assertThat(rscCaptor.getValue().getReturnType(), is(methodInstrumentationConfig.getReturnType())); assertThat(rscCaptor.getValue().isStartsInvocation(), is(sensorInstrumentationPoint.isStartsInvocation())); assertThat(rscCaptor.getValue().getSettings(), is(sensorInstrumentationPoint.getSettings()));
assertThat(instrumentationConfig.getTargetClassFqn(), is(packageName + '.' + className)); assertThat(instrumentationConfig.getTargetMethodName(), is(methodName)); assertThat(instrumentationConfig.getReturnType(), is(returnType)); assertThat(instrumentationConfig.getParameterTypes(), is(parameters)); assertThat(instrumentationConfig.getAllInstrumentationPoints(), hasSize(2));
when(methodInstrumentationConfig.getReturnType()).thenReturn("void"); when(methodInstrumentationConfig.getParameterTypes()).thenReturn(Collections.<String> emptyList()); when(methodInstrumentationConfig.getSensorInstrumentationPoint()).thenReturn(sensorInstrumentationPoint); assertThat(rscCaptor.getValue().getTargetClassFqn(), is(methodInstrumentationConfig.getTargetClassFqn())); assertThat(rscCaptor.getValue().getTargetMethodName(), is(methodInstrumentationConfig.getTargetMethodName())); assertThat(rscCaptor.getValue().getReturnType(), is(methodInstrumentationConfig.getReturnType())); assertThat(rscCaptor.getValue().isStartsInvocation(), is(sensorInstrumentationPoint.isStartsInvocation())); assertThat(rscCaptor.getValue().getSettings(), is(sensorInstrumentationPoint.getSettings()));
assertThat(instrumentationConfig.getTargetClassFqn(), is(packageName + '.' + className)); assertThat(instrumentationConfig.getTargetMethodName(), is(methodName)); assertThat(instrumentationConfig.getReturnType(), is(returnType)); assertThat(instrumentationConfig.getParameterTypes(), is(parameters)); assertThat(instrumentationConfig.getAllInstrumentationPoints(), hasSize(1));
/** * Copies all the class/method information from the {@link MethodInstrumentationConfig} to the * {@link AbstractSensorConfig}. * * @param asc * {@link AbstractSensorConfig} * @param config * {@link MethodInstrumentationConfig} */ private void copyInfo(AbstractSensorConfig asc, MethodInstrumentationConfig config) { asc.setTargetClassFqn(config.getTargetClassFqn()); asc.setTargetMethodName(config.getTargetMethodName()); asc.setReturnType(config.getReturnType()); asc.setParameterTypes(config.getParameterTypes()); }
assertThat(instrumentationConfig.getTargetClassFqn(), is(className)); assertThat(instrumentationConfig.getTargetMethodName(), is(methodName)); assertThat(instrumentationConfig.getReturnType(), is(returnType)); assertThat(instrumentationConfig.getParameterTypes(), is(parameters)); assertThat(instrumentationConfig.getAllInstrumentationPoints(), hasSize(2));
assertThat(instrumentationConfig.getTargetClassFqn(), is(packageName + '.' + className)); assertThat(instrumentationConfig.getTargetMethodName(), is(methodName)); assertThat(instrumentationConfig.getReturnType(), is(returnType)); assertThat(instrumentationConfig.getParameterTypes(), is(parameters)); assertThat(instrumentationConfig.getAllInstrumentationPoints(), hasSize(1));
assertThat(instrumentationConfig.getTargetClassFqn(), is(packageName + '.' + className)); assertThat(instrumentationConfig.getTargetMethodName(), is(methodName)); assertThat(instrumentationConfig.getReturnType(), is(returnType)); assertThat(instrumentationConfig.getParameterTypes(), is(parameters)); assertThat(instrumentationConfig.getAllInstrumentationPoints(), hasSize(1));
when(methodInstrumentationConfig.getReturnType()).thenReturn("void"); when(methodInstrumentationConfig.getParameterTypes()).thenReturn(Collections.<String> emptyList()); when(methodInstrumentationConfig.getSensorInstrumentationPoint()).thenReturn(sensorInstrumentationPoint); assertThat(rscCaptor.getValue().getTargetClassFqn(), is(methodInstrumentationConfig.getTargetClassFqn())); assertThat(rscCaptor.getValue().getTargetMethodName(), is(methodInstrumentationConfig.getTargetMethodName())); assertThat(rscCaptor.getValue().getReturnType(), is(methodInstrumentationConfig.getReturnType())); assertThat(rscCaptor.getValue().isStartsInvocation(), is(sensorInstrumentationPoint.isStartsInvocation())); assertThat(rscCaptor.getValue().getSettings(), is(sensorInstrumentationPoint.getSettings()));