Tabnine Logo
ClassInstrumentationChangedEvent.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
rocks.inspectit.server.ci.event.ClassInstrumentationChangedEvent
constructor

Best Java code snippets using rocks.inspectit.server.ci.event.ClassInstrumentationChangedEvent.<init> (Showing top 14 results out of 315)

origin: inspectIT/inspectIT

  @Test(expectedExceptions = IllegalArgumentException.class)
  @SuppressWarnings("unchecked")
  public void emptyDefinitions() {
    new ClassInstrumentationChangedEvent(this, 10L, Collections.EMPTY_LIST);
  }
}
origin: inspectIT/inspectIT

@Test(expectedExceptions = IllegalArgumentException.class)
public void nullDefinitions() {
  new ClassInstrumentationChangedEvent(this, 10L, null);
}
origin: inspectIT/inspectIT

@Test
public void successful() {
  List<InstrumentationDefinition> instrumentationDefinitions = Arrays.asList(mock(InstrumentationDefinition.class));
  ClassInstrumentationChangedEvent event = new ClassInstrumentationChangedEvent(this, 10L, instrumentationDefinitions);
  assertThat(event.getAgentId(), is(equalTo(10L)));
  assertThat(instrumentationDefinitions, is(equalTo(event.getInstrumentationDefinitions())));
}
origin: inspectIT/inspectIT

  @Test
  public void unknownPlatformId() throws Exception {
    when(definition.getClassName()).thenReturn("class.one");
    ClassInstrumentationChangedEvent event = new ClassInstrumentationChangedEvent(this, 10L, Arrays.asList(definition));
    messageGate.onApplicationEvent(event);
    messageGate.clear(20L);
    verifyZeroInteractions(messageProvider);
    assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(1));
  }
}
origin: inspectIT/inspectIT

@Test
@SuppressWarnings("unchecked")
public void changeEventNoAgentStatusData() throws Exception {
  when(definitionOne.getClassName()).thenReturn("class.one");
  ClassInstrumentationChangedEvent eventOne = new ClassInstrumentationChangedEvent(this, 10L, Arrays.asList(definitionOne));
  when(agentStatusDataProvider.getAgentStatusDataMap()).thenReturn(Collections.EMPTY_MAP);
  messageGate.onApplicationEvent(eventOne);
  verify(agentStatusDataProvider).getAgentStatusDataMap();
  verifyNoMoreInteractions(agentStatusDataProvider);
  verifyZeroInteractions(statusData, messageProvider);
}
origin: inspectIT/inspectIT

ClassInstrumentationChangedEvent event = new ClassInstrumentationChangedEvent(this, getAgentId(), instrumentationDefinitions);
eventPublisher.publishEvent(event);
origin: inspectIT/inspectIT

@Test
public void successful() throws Exception {
  when(definition.getClassName()).thenReturn("class.one");
  ClassInstrumentationChangedEvent event = new ClassInstrumentationChangedEvent(this, 10L, Arrays.asList(definition));
  messageGate.onApplicationEvent(event);
  messageGate.clear(10L);
  verifyZeroInteractions(messageProvider);
  assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(0));
}
origin: inspectIT/inspectIT

@Test
public void agentRegisteredEvent() throws Exception {
  when(definitionOne.getClassName()).thenReturn("class.one");
  ClassInstrumentationChangedEvent event = new ClassInstrumentationChangedEvent(this, 10L, Collections.singletonList(definitionOne));
  messageGate.onApplicationEvent(event);
  AgentRegisteredEvent registeredEvent = new AgentRegisteredEvent(this, 10L);
  messageGate.onApplicationEvent(registeredEvent);
  assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(0));
}
origin: inspectIT/inspectIT

  @Test
  @SuppressWarnings("unchecked")
  public void unknownPlatformId() throws Exception {
    when(definition.getClassName()).thenReturn("class.one");
    ClassInstrumentationChangedEvent event = new ClassInstrumentationChangedEvent(this, 10L, Arrays.asList(definition));
    messageGate.onApplicationEvent(event);
    when(agentStatusDataProvider.getAgentStatusDataMap()).thenReturn(Collections.EMPTY_MAP);
    assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(1));
    messageGate.flush(20L);
    verifyZeroInteractions(messageProvider);
    assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(1));
  }
}
origin: inspectIT/inspectIT

@Test
public void agentDeletedEvent() throws Exception {
  when(definitionOne.getClassName()).thenReturn("class.one");
  ClassInstrumentationChangedEvent event = new ClassInstrumentationChangedEvent(this, 10L, Collections.singletonList(definitionOne));
  messageGate.onApplicationEvent(event);
  AgentDeletedEvent deletedEvent = new AgentDeletedEvent(this, 10L);
  messageGate.onApplicationEvent(deletedEvent);
  assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(0));
}
origin: inspectIT/inspectIT

@Test
@SuppressWarnings("unchecked")
public void changeEventReplaceInstrumentationDefinition() throws Exception {
  when(definitionOne.getClassName()).thenReturn("class.one");
  when(definitionTwo.getClassName()).thenReturn("class.two");
  when(definitionThree.getClassName()).thenReturn("class.one");
  ClassInstrumentationChangedEvent eventOne = new ClassInstrumentationChangedEvent(this, 10L, Arrays.asList(definitionOne, definitionTwo));
  ClassInstrumentationChangedEvent eventTwo = new ClassInstrumentationChangedEvent(this, 10L, Arrays.asList(definitionThree));
  when(agentStatusDataProvider.getAgentStatusDataMap()).thenReturn(Collections.EMPTY_MAP);
  when(statusData.getInstrumentationStatus()).thenReturn(InstrumentationStatus.UP_TO_DATE, InstrumentationStatus.PENDING);
  messageGate.onApplicationEvent(eventOne);
  messageGate.onApplicationEvent(eventTwo);
  assertThat(getDefinitionBuffer().entrySet(), hasSize(1));
  assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(2));
  assertThat(getDefinitionBuffer().get(10L), hasEntry("class.one", definitionThree));
  assertThat(getDefinitionBuffer().get(10L), hasEntry("class.two", definitionTwo));
}
origin: inspectIT/inspectIT

@Test
@SuppressWarnings("rawtypes")
public void successful() throws Exception {
  when(definition.getClassName()).thenReturn("class.one");
  ClassInstrumentationChangedEvent event = new ClassInstrumentationChangedEvent(this, 10L, Arrays.asList(definition));
  messageGate.onApplicationEvent(event);
  when(agentStatusDataProvider.getAgentStatusDataMap()).thenReturn(ImmutableMap.of(10L, statusData));
  when(statusData.getInstrumentationStatus()).thenReturn(InstrumentationStatus.PENDING);
  assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(1));
  messageGate.flush(10L);
  ArgumentCaptor<IAgentMessage> messageCaptor = ArgumentCaptor.forClass(IAgentMessage.class);
  verify(messageProvider).provideMessage(eq(10L), messageCaptor.capture());
  verify(statusData).setInstrumentationStatus(InstrumentationStatus.UP_TO_DATE);
  verifyNoMoreInteractions(statusData, messageProvider);
  assertThat(((UpdatedInstrumentationMessage) messageCaptor.getValue()).getMessageContent(), contains(definition));
  assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(0));
}
origin: inspectIT/inspectIT

@Test
@SuppressWarnings("unchecked")
public void changeEventAddInstrumentationDefinitionForDiffrentAgents() throws Exception {
  when(definitionOne.getClassName()).thenReturn("class.one");
  when(definitionTwo.getClassName()).thenReturn("class.two");
  when(definitionThree.getClassName()).thenReturn("class.one");
  ClassInstrumentationChangedEvent eventOne = new ClassInstrumentationChangedEvent(this, 10L, Arrays.asList(definitionOne, definitionTwo));
  ClassInstrumentationChangedEvent eventTwo = new ClassInstrumentationChangedEvent(this, 20L, Arrays.asList(definitionThree));
  when(agentStatusDataProvider.getAgentStatusDataMap()).thenReturn(Collections.EMPTY_MAP);
  when(statusData.getInstrumentationStatus()).thenReturn(InstrumentationStatus.UP_TO_DATE, InstrumentationStatus.PENDING);
  messageGate.onApplicationEvent(eventOne);
  messageGate.onApplicationEvent(eventTwo);
  assertThat(getDefinitionBuffer().entrySet(), hasSize(2));
  assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(2));
  assertThat(getDefinitionBuffer().get(10L), hasEntry("class.one", definitionOne));
  assertThat(getDefinitionBuffer().get(10L), hasEntry("class.two", definitionTwo));
  assertThat(getDefinitionBuffer().get(20L).entrySet(), hasSize(1));
  assertThat(getDefinitionBuffer().get(20L), hasEntry("class.one", definitionThree));
}
origin: inspectIT/inspectIT

@Test
public void changeEventAddInstrumentationDefinitions() throws Exception {
  when(definitionOne.getClassName()).thenReturn("class.one");
  when(definitionTwo.getClassName()).thenReturn("class.two");
  when(definitionThree.getClassName()).thenReturn("class.three");
  ClassInstrumentationChangedEvent eventOne = new ClassInstrumentationChangedEvent(this, 10L, Arrays.asList(definitionOne, definitionTwo));
  ClassInstrumentationChangedEvent eventTwo = new ClassInstrumentationChangedEvent(this, 10L, Arrays.asList(definitionThree));
  when(agentStatusDataProvider.getAgentStatusDataMap()).thenReturn(ImmutableMap.of(10L, statusData));
  when(statusData.getInstrumentationStatus()).thenReturn(InstrumentationStatus.UP_TO_DATE, InstrumentationStatus.PENDING);
  long currentTime = System.currentTimeMillis();
  messageGate.onApplicationEvent(eventOne);
  messageGate.onApplicationEvent(eventTwo);
  verify(definitionOne).getClassName();
  verify(definitionTwo).getClassName();
  verify(definitionThree).getClassName();
  verify(agentStatusDataProvider, times(2)).getAgentStatusDataMap();
  verify(statusData, times(2)).getInstrumentationStatus();
  verify(statusData).setInstrumentationStatus(InstrumentationStatus.PENDING);
  ArgumentCaptor<Long> timeCaptor = ArgumentCaptor.forClass(Long.class);
  verify(statusData).setPendingSinceTime(timeCaptor.capture());
  verifyNoMoreInteractions(definitionOne, definitionTwo, definitionThree, agentStatusDataProvider, statusData);
  verifyZeroInteractions(messageProvider);
  assertThat(timeCaptor.getValue(), greaterThanOrEqualTo(currentTime));
  assertThat(getDefinitionBuffer().entrySet(), hasSize(1));
  assertThat(getDefinitionBuffer().get(10L).entrySet(), hasSize(3));
  assertThat(getDefinitionBuffer().get(10L), hasEntry("class.one", definitionOne));
  assertThat(getDefinitionBuffer().get(10L), hasEntry("class.two", definitionTwo));
  assertThat(getDefinitionBuffer().get(10L), hasEntry("class.three", definitionThree));
}
rocks.inspectit.server.ci.eventClassInstrumentationChangedEvent<init>

Javadoc

Default constructor for the event.

Popular methods of ClassInstrumentationChangedEvent

  • getAgentId
    Gets #agentId.
  • getInstrumentationDefinitions
    Gets #instrumentationDefinitions.

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • scheduleAtFixedRate (Timer)
  • getSharedPreferences (Context)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now