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

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

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

origin: inspectIT/inspectIT

  connect();
if (!isPlatformRegistered()) {
  register();
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@PostConstruct
public void afterPropertiesSet() throws Exception {
  doRegistration();
}
origin: inspectIT/inspectIT

/**
 * Tests that unregister of platform is executed if connection to the server is established
 * and registration is performed.
 */
@Test
public void unregisterPlatform() throws Exception {
  // first simulate connect
  long fakePlatformId = 3L;
  when(connection.isConnected()).thenReturn(true);
  when(configurationStorage.getAgentName()).thenReturn("testAgent");
  when(versionService.getVersionAsString()).thenReturn("dummyVersion");
  when(connection.register("testAgent", "dummyVersion")).thenReturn(agentConfiguration);
  when(agentConfiguration.getPlatformId()).thenReturn(fakePlatformId);
  platformManager.afterPropertiesSet();
  platformManager.getPlatformId();
  platformManager.unregisterPlatform();
  verify(connection, times(1)).unregister(fakePlatformId);
  verify(connection, times(1)).disconnect();
}
origin: inspectIT/inspectIT

@Test
public void retrievePlatformId() throws Exception {
  long fakePlatformId = 3L;
  when(connection.isConnected()).thenReturn(true);
  when(configurationStorage.getAgentName()).thenReturn("testAgent");
  when(versionService.getVersionAsString()).thenReturn("dummyVersion");
  when(connection.register("testAgent", "dummyVersion")).thenReturn(agentConfiguration);
  when(agentConfiguration.getPlatformId()).thenReturn(fakePlatformId);
  platformManager.afterPropertiesSet();
  long platformId = platformManager.getPlatformId();
  assertThat(platformId, is(equalTo(fakePlatformId)));
  verify(connection, times(0)).connect(anyString(), anyInt());
}
origin: inspectIT/inspectIT

when(platformManager.getPlatformId()).thenReturn(platformId);
verify(platformManager).getPlatformId();
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
@PreDestroy
public void unregisterPlatform() {
  if (connection.isConnected() && isPlatformRegistered()) {
    try {
      connection.unregister(platformId);
      connection.disconnect();
      platformId = -1;
    } catch (Throwable e) { // NOPMD
      log.warn("Could not un-register the platform.");
    }
  }
}
origin: inspectIT/inspectIT

/**
 * Test that unregister will not be called if there is no active connection to the server
 * and registration is not done at first place.
 */
@Test
public void noUnregisterPlatform() throws Exception {
  // no unregister if no connection
  when(connection.isConnected()).thenReturn(false);
  platformManager.unregisterPlatform();
  // no unregister if registration is not done at the first place
  when(connection.isConnected()).thenReturn(true);
  platformManager.unregisterPlatform();
  verify(connection, times(0)).unregister(anyLong());
}
origin: inspectIT/inspectIT

@Test
public void connectAndRetrievePlatformId() throws Exception {
  String host = "localhost";
  int port = 1099;
  RepositoryConfig repositoryConfig = mock(RepositoryConfig.class);
  when(repositoryConfig.getHost()).thenReturn(host);
  when(repositoryConfig.getPort()).thenReturn(port);
  when(configurationStorage.getRepositoryConfig()).thenReturn(repositoryConfig);
  when(configurationStorage.getAgentName()).thenReturn("testAgent");
  when(versionService.getVersionAsString()).thenReturn("dummyVersion");
  long fakePlatformId = 7L;
  when(connection.isConnected()).thenReturn(false);
  when(connection.register("testAgent", "dummyVersion")).thenReturn(agentConfiguration);
  when(agentConfiguration.getPlatformId()).thenReturn(fakePlatformId);
  platformManager.afterPropertiesSet();
  long platformId = platformManager.getPlatformId();
  assertThat(platformId, is(equalTo(fakePlatformId)));
  verify(connection, times(1)).connect(host, port);
}
origin: inspectIT/inspectIT

when(platformManager.getPlatformId()).thenReturn(platformId);
verify(timer, times(3)).getCurrentTime();
statementHook2.secondAfterBody(coreService, methodId, sensorTypeId, object, parameters, result, false, registeredSensorConfig);
verify(platformManager).getPlatformId();
verify(platformManager, times(2)).getPlatformId();
rocks.inspectit.agent.java.core.implPlatformManager

Javadoc

The platform manager that only holds the platform ident id and performs simple registration on the start-up.

Most used methods

  • afterPropertiesSet
  • connect
    Establish the connection to the server.
  • doRegistration
    Performs the registration.
  • getPlatformId
    For now just return the id.
  • isPlatformRegistered
  • register
    Registers the platform at the CMR.
  • unregisterPlatform

Popular in Java

  • Making http post requests using okhttp
  • getSharedPreferences (Context)
  • getApplicationContext (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top 17 Plugins for Android Studio
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