Tabnine Logo
ProfileUpdateEvent.getRemovedSensorAssignments
Code IndexAdd Tabnine to your IDE (free)

How to use
getRemovedSensorAssignments
method
in
rocks.inspectit.server.ci.event.ProfileUpdateEvent

Best Java code snippets using rocks.inspectit.server.ci.event.ProfileUpdateEvent.getRemovedSensorAssignments (Showing top 10 results out of 315)

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

@Test
public void activated() {
  when(old.getId()).thenReturn(ID);
  when(updated.getId()).thenReturn(ID);
  doReturn(Collections.singletonList(assignment)).when(oldProfileData).getData(SensorAssignmentProfileData.class);
  doReturn(Collections.singletonList(assignment)).when(updatedProfileData).getData(SensorAssignmentProfileData.class);
  when(old.isActive()).thenReturn(false);
  when(updated.isActive()).thenReturn(true);
  ProfileUpdateEvent event = new ProfileUpdateEvent(this, old, updated);
  Collection<AbstractClassSensorAssignment<?>> removed = event.getRemovedSensorAssignments();
  assertThat(removed, is(empty()));
}
origin: inspectIT/inspectIT

@Test
public void noChange() {
  when(old.getId()).thenReturn(ID);
  when(updated.getId()).thenReturn(ID);
  doReturn(Collections.singletonList(assignment)).when(oldProfileData).getData(SensorAssignmentProfileData.class);
  doReturn(Collections.singletonList(assignment)).when(updatedProfileData).getData(SensorAssignmentProfileData.class);
  when(old.isActive()).thenReturn(true);
  when(updated.isActive()).thenReturn(true);
  ProfileUpdateEvent event = new ProfileUpdateEvent(this, old, updated);
  Collection<AbstractClassSensorAssignment<?>> removed = event.getRemovedSensorAssignments();
  assertThat(removed, is(empty()));
}
origin: inspectIT/inspectIT

  @Test
  public void wrongProfileData() {
    when(old.getId()).thenReturn(ID);
    when(updated.getId()).thenReturn(ID);
    when(oldProfileData.isOfType(SensorAssignmentProfileData.class)).thenReturn(false);
    when(updatedProfileData.isOfType(SensorAssignmentProfileData.class)).thenReturn(false);
    when(old.isActive()).thenReturn(true);
    when(updated.isActive()).thenReturn(true);
    ProfileUpdateEvent event = new ProfileUpdateEvent(this, old, updated);
    Collection<AbstractClassSensorAssignment<?>> removed = event.getRemovedSensorAssignments();
    assertThat(removed, is(empty()));
  }
}
origin: inspectIT/inspectIT

@Test
public void deactivated() {
  when(old.getId()).thenReturn(ID);
  when(updated.getId()).thenReturn(ID);
  doReturn(Collections.singletonList(assignment)).when(oldProfileData).getData(SensorAssignmentProfileData.class);
  doReturn(Collections.singletonList(assignment)).when(updatedProfileData).getData(SensorAssignmentProfileData.class);
  when(old.isActive()).thenReturn(true);
  when(updated.isActive()).thenReturn(false);
  ProfileUpdateEvent event = new ProfileUpdateEvent(this, old, updated);
  Collection<AbstractClassSensorAssignment<?>> removed = event.getRemovedSensorAssignments();
  assertThat(removed, hasSize(1));
  assertThat(removed, hasItem(assignment));
}
origin: inspectIT/inspectIT

@Test
public void removedAssignments() {
  when(old.getId()).thenReturn(ID);
  when(updated.getId()).thenReturn(ID);
  doReturn(Collections.singletonList(assignment)).when(oldProfileData).getData(SensorAssignmentProfileData.class);
  doReturn(Collections.<AbstractClassSensorAssignment<?>> emptyList()).when(updatedProfileData).getData(SensorAssignmentProfileData.class);
  when(old.isActive()).thenReturn(true);
  when(updated.isActive()).thenReturn(true);
  ProfileUpdateEvent event = new ProfileUpdateEvent(this, old, updated);
  Collection<AbstractClassSensorAssignment<?>> removed = event.getRemovedSensorAssignments();
  assertThat(removed, hasSize(1));
  assertThat(removed, hasItem(assignment));
}
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 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

@Test
public void updateProfileMethodAssignmentsChange() throws Exception {
  MethodSensorAssignment methodSensorAssignment1 = mock(MethodSensorAssignment.class);
  MethodSensorAssignment methodSensorAssignment2 = mock(MethodSensorAssignment.class);
  Profile profile = new Profile();
  profile.setName("test");
  SensorAssignmentProfileData profileData = new SensorAssignmentProfileData();
  profileData.setMethodSensorAssignments(Collections.singletonList(methodSensorAssignment1));
  profile.setProfileData(profileData);
  Profile created = manager.createProfile(profile);
  assertThat((Collection<MethodSensorAssignment>) profile.getProfileData().getData(SensorAssignmentProfileData.class), hasItem(methodSensorAssignment1));
  profile = new Profile();
  profile.setId(created.getId());
  profile.setRevision(created.getRevision());
  profile.setName(created.getName());
  profileData = new SensorAssignmentProfileData();
  profileData.setMethodSensorAssignments(Collections.singletonList(methodSensorAssignment2));
  profile.setProfileData(profileData);
  Profile updated = manager.updateProfile(profile);
  assertThat((Collection<MethodSensorAssignment>) profile.getProfileData().getData(SensorAssignmentProfileData.class), hasItem(methodSensorAssignment2));
  assertThat(updated.getRevision(), is(2));
  ArgumentCaptor<ApplicationEvent> captor = ArgumentCaptor.forClass(ApplicationEvent.class);
  verify(eventPublisher).publishEvent(captor.capture());
  assertThat(captor.getValue(), is(instanceOf(ProfileUpdateEvent.class)));
  ProfileUpdateEvent profileUpdateEvent = (ProfileUpdateEvent) captor.getValue();
  assertThat(profileUpdateEvent.getRemovedSensorAssignments(), hasItem(methodSensorAssignment1));
  assertThat(profileUpdateEvent.getAddedSensorAssignments(), hasItem(methodSensorAssignment2));
}
origin: inspectIT/inspectIT

@Test
public void updateProfileExceptionAssignmentsChange() throws Exception {
  ExceptionSensorAssignment exceptionSensorAssignment1 = mock(ExceptionSensorAssignment.class);
  ExceptionSensorAssignment exceptionSensorAssignment2 = mock(ExceptionSensorAssignment.class);
  Profile profile = new Profile();
  profile.setName("test");
  SensorAssignmentProfileData profileData = new SensorAssignmentProfileData();
  profileData.setExceptionSensorAssignments(Collections.singletonList(exceptionSensorAssignment1));
  profile.setProfileData(profileData);
  Profile created = manager.createProfile(profile);
  assertThat((Collection<ExceptionSensorAssignment>) profile.getProfileData().getData(SensorAssignmentProfileData.class), hasItem(exceptionSensorAssignment1));
  profile = new Profile();
  profile.setId(created.getId());
  profile.setRevision(created.getRevision());
  profile.setName(created.getName());
  profileData = new SensorAssignmentProfileData();
  profileData.setExceptionSensorAssignments(Collections.singletonList(exceptionSensorAssignment2));
  profile.setProfileData(profileData);
  Profile updated = manager.updateProfile(profile);
  assertThat((Collection<ExceptionSensorAssignment>) profile.getProfileData().getData(SensorAssignmentProfileData.class), hasItem(exceptionSensorAssignment2));
  assertThat(updated.getRevision(), is(2));
  ArgumentCaptor<ApplicationEvent> captor = ArgumentCaptor.forClass(ApplicationEvent.class);
  verify(eventPublisher).publishEvent(captor.capture());
  assertThat(captor.getValue(), is(instanceOf(ProfileUpdateEvent.class)));
  ProfileUpdateEvent profileUpdateEvent = (ProfileUpdateEvent) captor.getValue();
  assertThat(profileUpdateEvent.getRemovedSensorAssignments(), hasItem(exceptionSensorAssignment1));
  assertThat(profileUpdateEvent.getAddedSensorAssignments(), hasItem(exceptionSensorAssignment2));
}
rocks.inspectit.server.ci.eventProfileUpdateEventgetRemovedSensorAssignments

Javadoc

Returns all AbstractClassSensorAssignment that are "removed" as result of this update. If profile was deactivated then it means that all assignments before the update are considered for removal.

Popular methods of ProfileUpdateEvent

  • <init>
    Default constructor.
  • getAddedSensorAssignments
    Returns all AbstractClassSensorAssignment that are "added" as result of this update. If profile was
  • getProfileId
    Returns id of the profile being updated.
  • isProfileActivated
    If profile was activated as the result of the update action.
  • isProfileActive
    Returns if the profile is active.
  • isProfileDeactivated
    If profile was deactivated as the result of the update action.
  • getAllSensorAssignments
    Returns all AbstractClassSensorAssignments from the profile.
  • getAssignmentsDifference
    Finds AbstractClassSensorAssignments that exists in first profile and not in the second one.

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSharedPreferences (Context)
  • setScale (BigDecimal)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top 12 Jupyter Notebook extensions
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