Codota Logo
CoreService
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
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
  • getSharedPreferences (Context)
  • onCreateOptionsMenu (Activity)
  • putExtra (Intent)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
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