Codota Logo
ConfigurationHolder.getInstrumentationAppliers
Code IndexAdd Codota to your IDE (free)

How to use
getInstrumentationAppliers
method
in
rocks.inspectit.server.instrumentation.config.ConfigurationHolder

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
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

@BeforeMethod
public void init() throws Exception {
  MockitoAnnotations.initMocks(this);
  job.log = LoggerFactory.getLogger(EnvironmentMappingUpdateJob.class);
  job.setAgentCacheEntry(agentCacheEntry);
  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(classCache.getLookupService()).thenReturn(lookupService);
  when(classType.isClass()).thenReturn(true);
  when(classType.castToClass()).thenReturn(immutableClassType);
}
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(10L);
  when(classCache.getInstrumentationService()).thenReturn(instrumentationService);
  when(classTypeOne.isClass()).thenReturn(true);
  when(classTypeTwo.isClass()).thenReturn(true);
  when(classTypeOne.castToClass()).thenReturn(immutableClassTypeOne);
  when(classTypeTwo.castToClass()).thenReturn(immutableClassTypeTwo);
  when(immutableClassTypeOne.hasInstrumentationPoints()).thenReturn(true);
  when(immutableClassTypeOne.hasInstrumentationPoints()).thenReturn(false);
  when(classTypeOne.getFQN()).thenReturn("fqnOne");
  when(classTypeTwo.getFQN()).thenReturn("fqnTwo");
}
origin: inspectIT/inspectIT

  @Test
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public void yesEnvironment() {
    when(configurationHolder.isInitialized()).thenReturn(true);
    when(configurationHolder.getAgentConfiguration()).thenReturn(updateConfiguration);
    doReturn(Collections.singletonList(classType)).when(instrumentationService).addInstrumentationPoints(any(AgentConfig.class), any(Collection.class));

    job.setEnvironment(updateEnvironment);
    job.run();

    verify(instrumentationService, times(1)).removeInstrumentationPoints();
    verify(configurationHolder, times(1)).update(updateEnvironment, PLATFORM_ID);

    Collection<IInstrumentationApplier> appliers = configurationHolder.getInstrumentationAppliers();
    verify(instrumentationService, times(1)).addInstrumentationPoints(updateConfiguration, appliers);

    ArgumentCaptor<Collection> typeCaptor = ArgumentCaptor.forClass(Collection.class);
    verify(instrumentationService).getInstrumentationResults(typeCaptor.capture());
    assertThat((Collection<Type>) typeCaptor.getValue(), hasItems((Type) classType));

    verify(eventPublisher).publishEvent(any(ClassInstrumentationChangedEvent.class));

    verifyNoMoreInteractions(instrumentationService, updateConfiguration, updateEnvironment, eventPublisher);
  }
}
origin: inspectIT/inspectIT

@Test
public void removedAssignment() throws RemoteException, BusinessException {
  Collection<ClassType> types = Collections.singleton(classType);
  doReturn(instrumentationApplier).when(configurationResolver).getInstrumentationApplier(sensorAssignment, environment);
  doReturn(types).when(classCacheSearchNarrower).narrowByClassSensorAssignment(classCache, sensorAssignment);
  doReturn(types).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);
  verify(instrumentationService, times(1)).removeInstrumentationPoints(types, Collections.singleton(instrumentationApplier));
  ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
  Collection<IInstrumentationApplier> appliers = configurationHolder.getInstrumentationAppliers();
  verify(instrumentationService, times(1)).addInstrumentationPoints(captor.capture(), eq(agentConfiguration), eq(appliers));
  assertThat((Collection<ClassType>) captor.getValue(), hasSize(1));
  assertThat(((Collection<ClassType>) captor.getValue()).iterator().next(), is(classType));
  ArgumentCaptor<ClassInstrumentationChangedEvent> eventCaptor = ArgumentCaptor.forClass(ClassInstrumentationChangedEvent.class);
  verify(eventPublisher).publishEvent(eventCaptor.capture());
  assertThat(eventCaptor.getValue().getAgentId(), is(equalTo(PLATFORM_ID)));
  assertThat(eventCaptor.getValue().getInstrumentationDefinitions(), contains(org.hamcrest.Matchers.<InstrumentationDefinition> hasProperty("className", equalTo("fqn"))));
  verifyNoMoreInteractions(eventPublisher);
  verifyZeroInteractions(environment, agentConfiguration);
}
origin: inspectIT/inspectIT

@Test
public void existingClassTypeInstrumented() throws BusinessException, ClassCacheModificationException {
  List<String> definedIPs = mock(List.class);
  String agentName = "agentName";
  String version = "v1";
  when(registrationService.registerPlatformIdent(definedIPs, agentName, version)).thenReturn(ID);
  manager.register(definedIPs, agentName, version);
  ClassType classType = mock(ClassType.class);
  when(classType.isClass()).thenReturn(true);
  when(classType.castToClass()).thenReturn(classType);
  when(lookupService.findByHash(HASH)).thenReturn(classType);
  when(configurationHolder.isInitialized()).thenReturn(true);
  AgentConfig configuration = mock(AgentConfig.class);
  Collection<IInstrumentationApplier> appliers = mock(Collection.class);
  InstrumentationDefinition instrumentationResult = mock(InstrumentationDefinition.class);
  when(configurationHolder.getAgentConfiguration()).thenReturn(configuration);
  when(configurationHolder.getInstrumentationAppliers()).thenReturn(appliers);
  when(instrumentationService.addAndGetInstrumentationResult(classType, configuration, appliers)).thenReturn(instrumentationResult);
  InstrumentationDefinition result = manager.analyze(ID, HASH, type);
  assertThat(result, is(instrumentationResult));
  verify(instrumentationService).addAndGetInstrumentationResult(classType, configuration, appliers);
  verifyNoMoreInteractions(instrumentationService);
  verifyZeroInteractions(modificationService);
}
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

@Test
public void removedAssignment() throws RemoteException {
  Collection<ClassType> types = ImmutableList.of(classTypeOne, classTypeTwo);
  doReturn(instrumentationApplier).when(configurationResolver).getInstrumentationApplier(sensorAssignment, environment);
  doReturn(types).when(classCacheSearchNarrower).narrowByClassSensorAssignment(classCache, sensorAssignment);
  doReturn(types).when(instrumentationService).removeInstrumentationPoints(eq(types), Matchers.<Collection<IInstrumentationApplier>> any());
  doReturn(Collections.singleton(sensorAssignment)).when(event).getRemovedSensorAssignments();
  job.setProfileUpdateEvent(event);
  job.run();
  ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
  verify(instrumentationService, times(1)).removeInstrumentationPoints(eq(types), captor.capture());
  assertThat((Collection<IInstrumentationApplier>) captor.getValue(), hasSize(1));
  assertThat(((Collection<IInstrumentationApplier>) captor.getValue()).iterator().next(), is(instrumentationApplier));
  ArgumentCaptor<Collection> typeCaptor = ArgumentCaptor.forClass(Collection.class);
  verify(instrumentationService).getInstrumentationResults(typeCaptor.capture());
  assertThat((Collection<ClassType>) typeCaptor.getValue(), hasItems(classTypeOne, classTypeTwo));
  Collection<IInstrumentationApplier> appliers = configurationHolder.getInstrumentationAppliers();
  verify(instrumentationService, times(1)).addInstrumentationPoints(captor.capture(), eq(agentConfiguration), eq(appliers));
  assertThat((Collection<ClassType>) captor.getValue(), hasSize(2));
  assertThat(((Collection<ClassType>) captor.getValue()).iterator().next(), is(classTypeOne));
  ArgumentCaptor<ClassInstrumentationChangedEvent> eventCaptor = ArgumentCaptor.forClass(ClassInstrumentationChangedEvent.class);
  verify(eventPublisher).publishEvent(eventCaptor.capture());
  assertThat(eventCaptor.getValue().getAgentId(), is(equalTo(10L)));
  Matcher<InstrumentationDefinition> matcherOne = org.hamcrest.Matchers.<InstrumentationDefinition> hasProperty("className", equalTo("fqnOne"));
  Matcher<InstrumentationDefinition> matcherTwo = org.hamcrest.Matchers.<InstrumentationDefinition> hasProperty("className", equalTo("fqnTwo"));
  assertThat(eventCaptor.getValue().getInstrumentationDefinitions(), hasItems(matcherOne, matcherTwo));
  verifyNoMoreInteractions(instrumentationService, eventPublisher);
  verifyZeroInteractions(environment);
}
origin: inspectIT/inspectIT

/**
 * Process the removed assignments. All instrumentation points affected by the any of these
 * assignments are first completely removed. All classes that have any point removed will be
 * re-analyzed against complete configuration in order to reset the possible points coming not
 * from removed assignments.
 *
 * @param classSensorAssignments
 *            Collection of removed {@link AbstractClassSensorAssignment}s.
 * @return Returns a {@link Collection} of {@link ImmutableClassType} which have been removed.
 */
protected Collection<ImmutableClassType> processRemovedAssignments(Collection<? extends AbstractClassSensorAssignment<?>> classSensorAssignments) {
  Collection<ImmutableClassType> changedClassTypes = new ArrayList<>();
  // process all class sensor assignments for removal
  for (AbstractClassSensorAssignment<?> assignment : classSensorAssignments) {
    // narrow the search
    Collection<? extends ImmutableClassType> classTypes = classCacheSearchNarrower.narrowByClassSensorAssignment(getClassCache(), assignment);
    // get the applier
    IInstrumentationApplier instrumentationApplier = configurationResolver.getInstrumentationApplier(assignment, getEnvironment());
    changedClassTypes.addAll(getClassCache().getInstrumentationService().removeInstrumentationPoints(classTypes, Collections.singleton(instrumentationApplier)));
  }
  // if no class was affected just return
  if (CollectionUtils.isNotEmpty(changedClassTypes)) {
    // if any class was affected re-check those classes against complete configuration
    // because we removed all instrumentation points
    Collection<IInstrumentationApplier> instrumentationAppliers = getConfigurationHolder().getInstrumentationAppliers();
    getClassCache().getInstrumentationService().addInstrumentationPoints(changedClassTypes, getAgentConfiguration(), instrumentationAppliers);
  }
  return changedClassTypes;
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
protected Collection<ImmutableType> execute() {
  Collection<ImmutableType> changedClassTypes = new HashSet<>();
  // add current instrumentation
  changedClassTypes.addAll(getClassCache().getLookupService().findInstrumentedTypes());
  // first remove all existing instrumentation points
  getClassCache().getInstrumentationService().removeInstrumentationPoints();
  // then update configuration holder
  ConfigurationHolder configurationHolder = getConfigurationHolder();
  configurationHolder.update(environment, getAgentId());
  // if we are initialized analyze the complete class cache
  if (configurationHolder.isInitialized()) {
    // then add instrumentation points
    Collection<IInstrumentationApplier> instrumentationAppliers = configurationHolder.getInstrumentationAppliers();
    Collection<? extends ImmutableClassType> instrumentedTypes = getClassCache().getInstrumentationService().addInstrumentationPoints(getAgentConfiguration(), instrumentationAppliers);
    changedClassTypes.addAll(instrumentedTypes);
  }
  return changedClassTypes;
}
origin: inspectIT/inspectIT

return classCache.getInstrumentationService().addAndGetInstrumentationResult(classType, configurationHolder.getAgentConfiguration(), configurationHolder.getInstrumentationAppliers());
rocks.inspectit.server.instrumentation.configConfigurationHoldergetInstrumentationAppliers

Javadoc

Gets #instrumentationAppliers.

Popular methods of ConfigurationHolder

  • getAgentConfiguration
    Gets #agentConfiguration.
  • getEnvironment
    Gets #environment.
  • getJmxMonitoringAppliers
    Gets #jmxMonitoringAppliers.
  • isInitialized
    Returns if the configuration in this holder is properly initialized.
  • update
    Updates the defined configuration in the holder with following tasks: 1. Creates the new #agentConfi

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • getApplicationContext (Context)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Path (java.nio.file)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • JTable (javax.swing)
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