Tabnine Logo
CoreService
Code IndexAdd Tabnine to your IDE (free)

How to use
CoreService
in
rocks.inspectit.agent.java.core.impl

Best Java code snippets using rocks.inspectit.agent.java.core.impl.CoreService (Showing top 12 results out of 315)

origin: inspectIT/inspectIT

@Test
public void noAddOnShutdown() throws InterruptedException, StorageException {
  when(disruptorStrategy.getDataBufferSize()).thenReturn(8);
  coreService.start();
  coreService.stop();
  coreService.addDefaultData(data);
  // need to sleep a bit so handler is notified
  Thread.sleep(100);
  verifyNoMoreInteractions(defaultDataHandler);
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@PostConstruct
public void start() {
  // start disruptor
  try {
    startDisruptor();
  } catch (Exception e) {
    throw new BeanInitializationException("Can not initialize disruptor.", e);
  }
  // schedule the sensor refresher runnable
  executorService.scheduleWithFixedDelay(new SensorRefresher(), sensorRefreshTime, sensorRefreshTime, TimeUnit.MILLISECONDS);
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@PreDestroy
public void stop() {
  if (shutdown) {
    return;
  }
  // mark shutdown started
  shutdown = true;
  // shutdown disruptor
  stopDisruptor();
  // kill executor service
  ExecutorServiceUtils.shutdownExecutor(executorService, 5L, TimeUnit.SECONDS);
}
origin: inspectIT/inspectIT

@Test
public void stop() throws Exception {
  when(disruptorStrategy.getDataBufferSize()).thenReturn(8);
  when(executorService.awaitTermination(anyLong(), Mockito.<TimeUnit> any())).thenReturn(true);
  coreService.start();
  coreService.stop();
  verify(executorService).scheduleWithFixedDelay(Mockito.<Runnable> any(), anyLong(), anyLong(), Mockito.<TimeUnit> any());
  verify(executorService).shutdown();
  verify(executorService).awaitTermination(anyLong(), Mockito.<TimeUnit> any());
  verifyNoMoreInteractions(executorService);
}
origin: inspectIT/inspectIT

@Test
public void happyPath() throws InterruptedException, StorageException {
  when(disruptorStrategy.getDataBufferSize()).thenReturn(8);
  coreService.start();
  coreService.addDefaultData(data);
  // need to sleep a bit so handler is notified
  Thread.sleep(100);
  ArgumentCaptor<DefaultDataWrapper> captor = ArgumentCaptor.forClass(DefaultDataWrapper.class);
  verify(defaultDataHandler).onEvent(captor.capture(), anyLong(), eq(true));
  assertThat(captor.getValue().getDefaultData(), is(data));
}
origin: inspectIT/inspectIT

@Test(expectedExceptions = BeanInitializationException.class)
public void bufferSizeNotPowerOf2() throws InterruptedException, StorageException {
  when(disruptorStrategy.getDataBufferSize()).thenReturn(5);
  coreService.start();
}
origin: inspectIT/inspectIT

@AfterMethod
public void stop() {
  coreService.stop();
}
origin: inspectIT/inspectIT

CoreService.this.addDefaultData(systemSensorData);
origin: inspectIT/inspectIT

  @Test
  public void stopTwice() throws Exception {
    when(disruptorStrategy.getDataBufferSize()).thenReturn(8);
    when(executorService.awaitTermination(anyLong(), Mockito.<TimeUnit> any())).thenReturn(true);
    coreService.start();
    coreService.stop();
    coreService.stop();
    verify(executorService).scheduleWithFixedDelay(Mockito.<Runnable> any(), anyLong(), anyLong(), Mockito.<TimeUnit> any());
    verify(executorService).shutdown();
    verify(executorService).awaitTermination(anyLong(), Mockito.<TimeUnit> any());
    verifyNoMoreInteractions(executorService);
  }
}
origin: inspectIT/inspectIT

@Test
public void capacityReached() throws InterruptedException, StorageException {
  when(disruptorStrategy.getDataBufferSize()).thenReturn(2);
  // slow down the wrapper so we get capacity error
  doAnswer(new Answer<Void>() {
    @Override
    public Void answer(InvocationOnMock invocation) throws Throwable {
      Thread.sleep(1);
      return null;
    }
  }).when(defaultDataHandler).onEvent(Mockito.<DefaultDataWrapper> any(), anyLong(), anyBoolean());
  coreService.start();
  coreService.addDefaultData(data);
  coreService.addDefaultData(data);
  coreService.addDefaultData(data);
  coreService.addDefaultData(data);
  // we should report 2 times
  verify(statsLogger, times(2)).dataDropped(1);
}
origin: inspectIT/inspectIT

@Test
public void sensorRefresherScheduled() throws StorageException {
  when(disruptorStrategy.getDataBufferSize()).thenReturn(8);
  coreService.start();
  ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class);
  verify(executorService).scheduleWithFixedDelay(captor.capture(), Mockito.anyLong(), Mockito.anyLong(), Mockito.<TimeUnit> any());
  assertThat(captor.getValue(), is(instanceOf(SensorRefresher.class)));
}
origin: inspectIT/inspectIT

@Test
public void platformSensorCollect() throws InterruptedException, StorageException {
  when(jmxSensors.isEmpty()).thenReturn(true);
  doAnswer(new Answer<Iterator<?>>() {
    @Override
    public Iterator<?> answer(InvocationOnMock invocation) throws Throwable {
      return new ArrayIterator(new IPlatformSensor[] { platformSensor });
    }
  }).when(platformSensors).iterator();
  SystemInformationData sid = mock(SystemInformationData.class);
  when(platformSensor.get()).thenReturn(sid);
  when(disruptorStrategy.getDataBufferSize()).thenReturn(8);
  coreService.start();
  Runnable sensorRefresher = coreService.new SensorRefresher();
  sensorRefresher.run();
  sensorRefresher.run();
  sensorRefresher.run();
  sensorRefresher.run();
  sensorRefresher.run();
  verify(platformSensor).reset();
  verify(platformSensor, times(5)).gather();
  verify(platformSensor).get();
  verifyNoMoreInteractions(platformSensor);
  // need to sleep a bit so handler is notified
  Thread.sleep(100);
  ArgumentCaptor<DefaultDataWrapper> captor = ArgumentCaptor.forClass(DefaultDataWrapper.class);
  verify(defaultDataHandler).onEvent(captor.capture(), anyLong(), eq(true));
  assertThat(captor.getValue().getDefaultData(), is((DefaultData) sid));
}
rocks.inspectit.agent.java.core.implCoreService

Most used methods

  • addDefaultData
  • start
  • startDisruptor
  • stop
  • stopDisruptor

Popular in Java

  • Finding current android device location
  • getExternalFilesDir (Context)
  • getContentResolver (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • JFrame (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top Sublime Text plugins
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