Codota Logo
ProfileUpdateJob
Code IndexAdd Codota to your IDE (free)

How to use
ProfileUpdateJob
in
rocks.inspectit.server.instrumentation.config.job

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: inspectIT/inspectIT

@Test
public void noChanges() {
  job.setProfileUpdateEvent(event);
  job.run();
  verifyZeroInteractions(classCache, environment, classCacheSearchNarrower, agentConfiguration, instrumentationService, eventPublisher);
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
protected Collection<ImmutableType> execute() {
  // always update configuration
  getConfigurationHolder().update(getEnvironment(), getAgentId());
  Collection<ImmutableType> changedClassTypes = new HashSet<>();
  // first process all removed and added assignments
  changedClassTypes.addAll(super.processRemovedAssignments(profileUpdateEvent.getRemovedSensorAssignments()));
  changedClassTypes.addAll(super.processAddedAssignments(profileUpdateEvent.getAddedSensorAssignments()));
  return changedClassTypes;
}
origin: inspectIT/inspectIT

profileUpdateJob.setProfileUpdateEvent(event);
profileUpdateJob.setAgentCacheEntry(agentCacheEntry);
origin: inspectIT/inspectIT

@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void successful() throws InterruptedException, ExecutionException, TimeoutException {
  cacheMap.put(1L, cacheEntry);
  when(event.isProfileActive()).thenReturn(true);
  when(event.getProfileId()).thenReturn("id_1");
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(environment.getProfileIds()).thenReturn(Sets.newHashSet("id_1"));
  when(objectFactory.getObject()).thenReturn(updateJob);
  when(executor.submit(updateJob)).thenReturn((Future) future);
  eventListener.onApplicationEvent(event);
  verify(event).isProfileActive();
  verify(event).getProfileId();
  verify(nextGenInstrumentationManager).getAgentCacheMap();
  verify(cacheEntry).getConfigurationHolder();
  verify(configurationHolder).getEnvironment();
  verify(configurationHolder).isInitialized();
  verify(environment, times(2)).getProfileIds();
  verify(objectFactory).getObject();
  verify(executor).submit(updateJob);
  verify(updateJob).setAgentCacheEntry(cacheEntry);
  verify(updateJob).setProfileUpdateEvent(event);
  verify(future).get(1L, TimeUnit.MINUTES);
  verifyNoMoreInteractions(event, cacheEntry, configurationHolder, environment, updateJob, future, nextGenInstrumentationManager, objectFactory, executor);
}
origin: inspectIT/inspectIT

@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void profileWasDeactivated() throws InterruptedException, ExecutionException, TimeoutException {
  cacheMap.put(1L, cacheEntry);
  when(event.isProfileDeactivated()).thenReturn(true);
  when(event.getProfileId()).thenReturn("id_1");
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(environment.getProfileIds()).thenReturn(Sets.newHashSet("id_1"));
  when(objectFactory.getObject()).thenReturn(updateJob);
  when(executor.submit(updateJob)).thenReturn((Future) future);
  eventListener.onApplicationEvent(event);
  verify(event).isProfileActive();
  verify(event).isProfileDeactivated();
  verify(event).getProfileId();
  verify(nextGenInstrumentationManager).getAgentCacheMap();
  verify(cacheEntry).getConfigurationHolder();
  verify(configurationHolder).getEnvironment();
  verify(configurationHolder).isInitialized();
  verify(environment, times(2)).getProfileIds();
  verify(objectFactory).getObject();
  verify(executor).submit(updateJob);
  verify(updateJob).setAgentCacheEntry(cacheEntry);
  verify(updateJob).setProfileUpdateEvent(event);
  verify(future).get(1L, TimeUnit.MINUTES);
  verifyNoMoreInteractions(event, cacheEntry, configurationHolder, environment, updateJob, future, nextGenInstrumentationManager, objectFactory, executor);
}
origin: inspectIT/inspectIT

  @Test
  public void removedAssignmentNoChange() throws RemoteException {
    Collection<ClassType> types = ImmutableList.of(classTypeOne, classTypeTwo);
    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.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));
    verifyNoMoreInteractions(instrumentationService);
    verifyZeroInteractions(environment, eventPublisher);
  }
}
origin: inspectIT/inspectIT

@Test
public void addedAssignment() 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).addInstrumentationPoints(eq(types), eq(agentConfiguration), Matchers.<Collection<IInstrumentationApplier>> any());
  doReturn(Collections.singleton(sensorAssignment)).when(event).getAddedSensorAssignments();
  job.setProfileUpdateEvent(event);
  job.run();
  ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
  verify(instrumentationService, times(1)).addInstrumentationPoints(eq(types), eq(agentConfiguration), 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));
  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

@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);
}
rocks.inspectit.server.instrumentation.config.jobProfileUpdateJob

Javadoc

Profile update job that runs for profile update against one environment/class cache.

Most used methods

  • setAgentCacheEntry
  • setProfileUpdateEvent
    Sets #profileUpdateEvent.
  • getAgentId
  • getConfigurationHolder
  • getEnvironment
  • run

Popular in Java

  • Making http requests using okhttp
  • onCreateOptionsMenu (Activity)
  • putExtra (Intent)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • 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
  • IsNull (org.hamcrest.core)
    Is the value null?
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