Tabnine Logo
EnvironmentUpdateEvent.getAddedSensorAssignments
Code IndexAdd Tabnine to your IDE (free)

How to use
getAddedSensorAssignments
method
in
rocks.inspectit.server.ci.event.EnvironmentUpdateEvent

Best Java code snippets using rocks.inspectit.server.ci.event.EnvironmentUpdateEvent.getAddedSensorAssignments (Showing top 7 results out of 315)

origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
protected Collection<ImmutableType> execute() {
  // always update with new Environment
  getConfigurationHolder().update(environmentUpdateEvent.getAfter(), getAgentId());
  Collection<ImmutableType> changedClassTypes = new HashSet<>();
  // then process removed and added assignments
  changedClassTypes.addAll(super.processRemovedAssignments(environmentUpdateEvent.getRemovedSensorAssignments(functionalAssignmentFactory)));
  changedClassTypes.addAll(super.processAddedAssignments(environmentUpdateEvent.getAddedSensorAssignments(functionalAssignmentFactory)));
  return changedClassTypes;
}
origin: inspectIT/inspectIT

@Test
public void profileAdded() {
  when(old.getId()).thenReturn(ID);
  when(updated.getId()).thenReturn(ID);
  AbstractClassSensorAssignment<?> assignment = mock(AbstractClassSensorAssignment.class);
  doReturn(Collections.singletonList(assignment)).when(profileData).getData(SensorAssignmentProfileData.class);
  when(profile.isActive()).thenReturn(true);
  EnvironmentUpdateEvent event = new EnvironmentUpdateEvent(this, old, updated, Collections.singletonList(profile), null);
  Collection<AbstractClassSensorAssignment<?>> added = event.getAddedSensorAssignments(functionalAssignmentFactory);
  assertThat(added, hasSize(1));
  assertThat(added, hasItem(assignment));
}
origin: inspectIT/inspectIT

@Test
public void profileRemovedNotActive() {
  when(old.getId()).thenReturn(ID);
  when(updated.getId()).thenReturn(ID);
  AbstractClassSensorAssignment<?> assignment = mock(AbstractClassSensorAssignment.class);
  doReturn(Collections.singletonList(assignment)).when(profileData).getData(SensorAssignmentProfileData.class);
  when(profile.isActive()).thenReturn(false);
  EnvironmentUpdateEvent event = new EnvironmentUpdateEvent(this, old, updated, Collections.singletonList(profile), null);
  Collection<AbstractClassSensorAssignment<?>> added = event.getAddedSensorAssignments(functionalAssignmentFactory);
  assertThat(added, is(empty()));
}
origin: inspectIT/inspectIT

@Test
public void functionalNoChange() {
  when(old.getId()).thenReturn(ID);
  when(updated.getId()).thenReturn(ID);
  SpecialMethodSensorAssignment functionalAssignment = mock(SpecialMethodSensorAssignment.class);
  when(functionalAssignmentFactory.getSpecialAssignments(old)).thenReturn(Collections.singletonList(functionalAssignment));
  when(functionalAssignmentFactory.getSpecialAssignments(updated)).thenReturn(Collections.singletonList(functionalAssignment));
  EnvironmentUpdateEvent event = new EnvironmentUpdateEvent(this, old, updated, null, null);
  Collection<AbstractClassSensorAssignment<?>> added = event.getAddedSensorAssignments(functionalAssignmentFactory);
  assertThat(added, is(empty()));
}
origin: inspectIT/inspectIT

@Test
public void functionalAdded() {
  when(old.getId()).thenReturn(ID);
  when(updated.getId()).thenReturn(ID);
  SpecialMethodSensorAssignment functionalAssignment = mock(SpecialMethodSensorAssignment.class);
  when(functionalAssignmentFactory.getSpecialAssignments(old)).thenReturn(Collections.<SpecialMethodSensorAssignment> emptyList());
  when(functionalAssignmentFactory.getSpecialAssignments(updated)).thenReturn(Collections.singletonList(functionalAssignment));
  EnvironmentUpdateEvent event = new EnvironmentUpdateEvent(this, old, updated, null, null);
  Collection<AbstractClassSensorAssignment<?>> added = event.getAddedSensorAssignments(functionalAssignmentFactory);
  assertThat(added, hasSize(1));
  assertThat(added, hasItem(functionalAssignment));
}
origin: inspectIT/inspectIT

  @Test
  public void wrongProfileData() {
    when(old.getId()).thenReturn(ID);
    when(updated.getId()).thenReturn(ID);
    when(profileData.isOfType(SensorAssignmentProfileData.class)).thenReturn(false);
    when(profile.isActive()).thenReturn(true);
    EnvironmentUpdateEvent event = new EnvironmentUpdateEvent(this, old, updated, null, Collections.singletonList(profile));
    Collection<AbstractClassSensorAssignment<?>> added = event.getAddedSensorAssignments(functionalAssignmentFactory);
    assertThat(added, is(empty()));
  }
}
origin: inspectIT/inspectIT

@Test
public void addedAssignment() 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).addInstrumentationPoints(eq(types), eq(agentConfiguration), Matchers.<Collection<IInstrumentationApplier>> any());
  doReturn(Collections.singletonList(sensorAssignment)).when(event).getAddedSensorAssignments(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)).addInstrumentationPoints(eq(types), eq(agentConfiguration), captor.capture());
  assertThat((Collection<IInstrumentationApplier>) captor.getValue(), hasSize(1));
  assertThat(((Collection<IInstrumentationApplier>) captor.getValue()).iterator().next(), is(instrumentationApplier));
  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);
}
rocks.inspectit.server.ci.eventEnvironmentUpdateEventgetAddedSensorAssignments

Javadoc

Returns all AbstractClassSensorAssignment that are contained in the added profiles. Only active profiles are taken into account. Also includes the functional assignments that might be added as the result of changes in the environment.

Popular methods of EnvironmentUpdateEvent

  • <init>
    Default constructor.
  • getAfter
    Gets #after.
  • getEnvironmentId
    Returns id of the environment being updated.
  • getRemovedSensorAssignments
    Returns all AbstractClassSensorAssignment that are contained in the removed profiles. Only active pr
  • getAddedProfiles
    Gets #addedProfiles.
  • getFunctionalAssignmentsDifference
    Returns the difference from the Functional assignments for the two environments. The resulting colle
  • getRemovedProfiles
    Gets #removedProfiles.
  • getSensorAssignments
    Collects all AbstractClassSensorAssignments from the given profiles. If profile is not active assign

Popular in Java

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • startActivity (Activity)
  • putExtra (Intent)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Top plugins for WebStorm
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