Tabnine Logo
rocks.inspectit.server.instrumentation.config
Code IndexAdd Tabnine to your IDE (free)

How to use rocks.inspectit.server.instrumentation.config

Best Java code snippets using rocks.inspectit.server.instrumentation.config (Showing top 20 results out of 315)

origin: inspectIT/inspectIT

/**
 * @return Returns class cache based on the {@link AgentCacheEntry}.
 */
protected ClassCache getClassCache() {
  return agentCacheEntry.getClassCache();
}
origin: inspectIT/inspectIT

/**
 * @return Returns configuration holder based on the {@link AgentCacheEntry}.
 */
protected ConfigurationHolder getConfigurationHolder() {
  return agentCacheEntry.getConfigurationHolder();
}
origin: inspectIT/inspectIT

/**
 * @return Returns agent id based on the {@link AgentCacheEntry}.
 */
protected long getAgentId() {
  return agentCacheEntry.getId();
}
origin: inspectIT/inspectIT

@Test
public void update() {
  long platformId = 11;
  Environment environment = mock(Environment.class);
  AgentConfig configuration = mock(AgentConfig.class);
  IInstrumentationApplier applier = mock(IInstrumentationApplier.class);
  JmxMonitoringApplier jmxApplier = mock(JmxMonitoringApplier.class);
  when(configurationCreator.environmentToConfiguration(environment, platformId)).thenReturn(configuration);
  when(configurationResolver.getInstrumentationAppliers(environment)).thenReturn(Collections.singleton(applier));
  when(configurationResolver.getJmxMonitoringAppliers(environment)).thenReturn(Collections.singleton(jmxApplier));
  holder.update(environment, platformId);
  assertThat(holder.isInitialized(), is(true));
  assertThat(holder.getEnvironment(), is(environment));
  assertThat(holder.getAgentConfiguration(), is(configuration));
  assertThat(holder.getInstrumentationAppliers(), hasSize(1));
  assertThat(holder.getInstrumentationAppliers(), hasItem(applier));
  assertThat(holder.getJmxMonitoringAppliers(), hasSize(1));
  assertThat(holder.getJmxMonitoringAppliers(), hasItem(jmxApplier));
  verify(configurationCreator).environmentToConfiguration(environment, platformId);
  verify(configurationResolver).getInstrumentationAppliers(environment);
  verify(configurationResolver).getJmxMonitoringAppliers(environment);
  verifyNoMoreInteractions(configurationCreator, configurationResolver);
}
origin: inspectIT/inspectIT

@BeforeMethod
public void setup() throws Exception {
  when(configurationHolder.getAgentConfiguration()).thenReturn(agentConfiguration);
  when(configurationHolder.getEnvironment()).thenReturn(environment);
  when(configurationHolder.getInstrumentationAppliers()).thenReturn(Collections.singletonList(holdedInstrumentationApplier));
  when(agentCacheEntry.getConfigurationHolder()).thenReturn(configurationHolder);
  when(agentCacheEntry.getClassCache()).thenReturn(classCache);
  when(agentCacheEntry.getId()).thenReturn(PLATFORM_ID);
  when(classCache.getInstrumentationService()).thenReturn(instrumentationService);
  when(classType.isClass()).thenReturn(true);
  when(classType.castToClass()).thenReturn(immutableClassType);
  when(classType.getFQN()).thenReturn("fqn");
  when(event.getAfter()).thenReturn(updateEnvironment);
}
origin: inspectIT/inspectIT

  @Test
  public void updateReset() {
    long platformId = 11;
    Environment environment = mock(Environment.class);
    AgentConfig configuration = mock(AgentConfig.class);
    IInstrumentationApplier applier = mock(IInstrumentationApplier.class);
    JmxMonitoringApplier jmxApplier = mock(JmxMonitoringApplier.class);
    when(configurationCreator.environmentToConfiguration(environment, platformId)).thenReturn(configuration);
    when(configurationResolver.getInstrumentationAppliers(environment)).thenReturn(Collections.singleton(applier));
    when(configurationResolver.getJmxMonitoringAppliers(environment)).thenReturn(Collections.singleton(jmxApplier));
    holder.update(environment, platformId);
    holder.update(null, platformId);
    assertThat(holder.isInitialized(), is(false));
    // only one time verifications
    verify(configurationCreator).environmentToConfiguration(environment, platformId);
    verify(configurationResolver).getInstrumentationAppliers(environment);
    verify(configurationResolver).getJmxMonitoringAppliers(environment);
    verifyNoMoreInteractions(configurationCreator, configurationResolver);
  }
}
origin: inspectIT/inspectIT

  @Test
  public void removedAssignmentNoChange() {
    Collection<ClassType> types = Collections.singleton(classType);
    doReturn(instrumentationApplier).when(configurationResolver).getInstrumentationApplier(sensorAssignment, environment);
    doReturn(types).when(classCacheSearchNarrower).narrowByClassSensorAssignment(classCache, sensorAssignment);
    doReturn(Collections.emptyList()).when(instrumentationService).removeInstrumentationPoints(eq(types), Matchers.<Collection<IInstrumentationApplier>> any());
    doReturn(Collections.singletonList(sensorAssignment)).when(event).getRemovedSensorAssignments(functionalAssignmentFactory);
    job.setEnvironmentUpdateEvent(event);
    job.run();
    verify(configurationHolder, times(1)).update(updateEnvironment, PLATFORM_ID);
    ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
    verify(instrumentationService, times(1)).removeInstrumentationPoints(types, Collections.singleton(instrumentationApplier));
    verifyNoMoreInteractions(instrumentationService);
    verifyZeroInteractions(environment, agentConfiguration, eventPublisher);
  }
}
origin: inspectIT/inspectIT

/**
 * Updates the defined configuration in the holder with following tasks:<br>
 * 1. Creates the new {@link #agentConfiguration} for given environment and platform id<br>
 * 2. Resolves all {@link #instrumentationAppliers} for given environment<br>
 * 3. sets the passes environment to the holder.
 * <p>
 * If <code>null</code> is passed then everything saved in the holder will be reset to
 * <code>null</code> as well.
 *
 * @param environment
 *            Environment to update the configuration and appliers with.
 * @param platformId
 *            Agent id needed for resolving configuration.
 */
public void update(Environment environment, long platformId) {
  if (null != environment) {
    this.environment = environment;
    this.agentConfiguration = configurationCreator.environmentToConfiguration(environment, platformId);
    this.instrumentationAppliers = configurationResolver.getInstrumentationAppliers(environment);
    this.jmxMonitoringAppliers = configurationResolver.getJmxMonitoringAppliers(environment);
  } else {
    this.environment = null; // NOPMD
    this.agentConfiguration = null; // NOPMD
    this.instrumentationAppliers = null; // NOPMD
    this.jmxMonitoringAppliers = null; // NOPMD
  }
}
origin: inspectIT/inspectIT

@BeforeMethod
public void beforeMethod() {
  cacheMap = new HashMap<>();
  when(nextGenInstrumentationManager.getAgentCacheMap()).thenReturn(cacheMap);
  when(cacheEntry.getConfigurationHolder()).thenReturn(configurationHolder);
  when(configurationHolder.getEnvironment()).thenReturn(environment);
}
origin: inspectIT/inspectIT

@Test
public void configurationNotInitialized() {
  cacheMap.put(1L, cacheEntry);
  when(configurationHolder.isInitialized()).thenReturn(false);
  eventListener.onApplicationEvent(event);
  verify(nextGenInstrumentationManager).getAgentCacheMap();
  verify(cacheEntry).getConfigurationHolder();
  verify(configurationHolder).isInitialized();
  verifyNoMoreInteractions(nextGenInstrumentationManager, cacheEntry, configurationHolder);
  verifyZeroInteractions(environment, event, objectFactory, updateJob, executor, future);
}
origin: inspectIT/inspectIT

/**
 * @return Returns environment based on the {@link ConfigurationHolder}.
 */
protected Environment getEnvironment() {
  return getConfigurationHolder().getEnvironment();
}
origin: inspectIT/inspectIT

/**
 * @return Returns agent configuration based on the {@link ConfigurationHolder}.
 */
protected AgentConfig getAgentConfiguration() {
  return getConfigurationHolder().getAgentConfiguration();
}
origin: inspectIT/inspectIT

  @Override
  public Void answer(InvocationOnMock invocation) throws Throwable {
    when(configurationHolder.getAgentConfiguration()).thenReturn(configuration);
    return null;
  }
}).when(configurationHolder).update(newEnvironment, id);
origin: inspectIT/inspectIT

  @Test
  public void notInitialziedWithoutEnvironment() {
    boolean initialized = holder.isInitialized();
    assertThat(initialized, is(false));
  }
}
origin: inspectIT/inspectIT

/**
 * Collects all realizing classes that are sub-class of given class type or any of its
 * sub-classes and adds them to the given results list. This method is recursive.
 *
 * @param results
 *            List to store classes to.
 * @param classType
 *            Type to check.
 */
private void collectClassesFromSubClasses(Collection<ImmutableClassType> results, ImmutableClassType classType) {
  for (ImmutableClassType subClassType : classType.getImmutableSubClasses()) {
    if (subClassType.isInitialized()) {
      results.add(subClassType);
    }
    collectClassesFromSubClasses(results, subClassType);
  }
}
origin: inspectIT/inspectIT

@BeforeMethod
public void beforeMethod() {
  cacheMap = new HashMap<>();
  when(nextGenInstrumentationManager.getAgentCacheMap()).thenReturn(cacheMap);
  when(cacheEntry.getConfigurationHolder()).thenReturn(configurationHolder);
  when(configurationHolder.getEnvironment()).thenReturn(environment);
}
origin: inspectIT/inspectIT

@Test
public void configurationNotInitialized() {
  cacheMap.put(1L, cacheEntry);
  when(event.isProfileActive()).thenReturn(true);
  when(event.getProfileId()).thenReturn("id_1");
  when(configurationHolder.isInitialized()).thenReturn(false);
  eventListener.onApplicationEvent(event);
  verify(event).isProfileActive();
  verify(nextGenInstrumentationManager).getAgentCacheMap();
  verify(cacheEntry).getConfigurationHolder();
  verify(configurationHolder).isInitialized();
  verifyNoMoreInteractions(event, cacheEntry, configurationHolder, nextGenInstrumentationManager);
  verifyZeroInteractions(environment, updateJob, future, objectFactory, executor);
}
origin: inspectIT/inspectIT

  @Override
  public Void answer(InvocationOnMock invocation) throws Throwable {
    when(configurationHolder.getAgentConfiguration()).thenReturn(configuration);
    return null;
  }
}).when(configurationHolder).update(environment, id);
origin: inspectIT/inspectIT

@BeforeMethod
public void beforeMethod() {
  cacheMap = new HashMap<>();
  when(nextGenInstrumentationManager.getAgentCacheMap()).thenReturn(cacheMap);
  when(cacheEntry.getConfigurationHolder()).thenReturn(configurationHolder);
  when(configurationHolder.getEnvironment()).thenReturn(cachedEnvironment);
  when(platformIdentDao.load(10L)).thenReturn(platformIdent);
}
origin: inspectIT/inspectIT

  @Override
  public Void answer(InvocationOnMock invocation) throws Throwable {
    when(configurationHolder.getAgentConfiguration()).thenReturn(configuration);
    return null;
  }
}).when(configurationHolder).update(environment, id);
rocks.inspectit.server.instrumentation.config

Most used classes

  • AgentCacheEntry
    Agent cache entry saved by the service.
  • ClassCacheSearchNarrower
    This class helps in getting the class types that fit the class sensor assignment.
  • ConfigurationCreator
    Configuration creator is responsible for creating the AgentConfig from the Environment.
  • ConfigurationHolder
    Configuration holder joins together all relative information needed for the instrumentation of the s
  • ConfigurationResolver
    Component that can resolve the different CI configuration points.
  • ExceptionSensorInstrumentationApplier,
  • IInstrumentationApplier,
  • InvocationStartMethodSensorInstrumentationApplier,
  • JmxMonitoringApplier,
  • MethodSensorInstrumentationApplier,
  • RemoveAllInstrumentationApplier,
  • SpecialInstrumentationApplier,
  • TimerMethodSensorInstrumentationApplier,
  • AssignmentFilterProvider,
  • ClassSensorAssignmentFilter,
  • JmxSensorAssignmentFilter,
  • MethodSensorAssignmentFilter,
  • EnvironmentMappingUpdateJob,
  • EnvironmentUpdateJob
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