Codota Logo
ConfigurationHolder.isInitialized
Code IndexAdd Codota to your IDE (free)

How to use
isInitialized
method
in
rocks.inspectit.server.instrumentation.config.ConfigurationHolder

Best Java code snippets using rocks.inspectit.server.instrumentation.config.ConfigurationHolder.isInitialized (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: inspectIT/inspectIT

  @Test
  public void notInitialziedWithoutEnvironment() {
    boolean initialized = holder.isInitialized();
    assertThat(initialized, is(false));
  }
}
origin: inspectIT/inspectIT

@Test
public void configurationNotInitialized() {
  cacheMap.put(1L, cacheEntry);
  when(configurationHolder.isInitialized()).thenReturn(false);
  eventListener.onApplicationEvent(event);
  verify(nextGenInstrumentationManager).getAgentCacheMap();
  verify(cacheEntry).getConfigurationHolder();
  verify(configurationHolder).isInitialized();
  verifyNoMoreInteractions(nextGenInstrumentationManager, cacheEntry, configurationHolder);
  verifyZeroInteractions(environment, event, objectFactory, updateJob, executor, future);
}
origin: inspectIT/inspectIT

@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void futureThrowsExecutionException() throws InterruptedException, ExecutionException, TimeoutException {
  cacheMap.put(1L, cacheEntry);
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(environment.getProfileIds()).thenReturn(Sets.newHashSet("id_1"));
  when(objectFactory.getObject()).thenReturn(updateJob);
  when(executor.submit(updateJob)).thenReturn((Future) future);
  when(future.get(1L, TimeUnit.MINUTES)).thenThrow(ExecutionException.class);
  eventListener.onApplicationEvent(event);
  verify(future).get(1, TimeUnit.MINUTES);
}
origin: inspectIT/inspectIT

  @Test
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public void futureThrowsInterruptedException() throws InterruptedException, ExecutionException, TimeoutException {
    cacheMap.put(1L, cacheEntry);
    when(configurationHolder.isInitialized()).thenReturn(true);
    when(environment.getProfileIds()).thenReturn(Sets.newHashSet("id_1"));
    when(objectFactory.getObject()).thenReturn(updateJob);
    when(executor.submit(updateJob)).thenReturn((Future) future);
    when(future.get(1L, TimeUnit.MINUTES)).thenThrow(InterruptedException.class);
    eventListener.onApplicationEvent(event);
    verify(future).get(1, TimeUnit.MINUTES);
  }
}
origin: inspectIT/inspectIT

@Test
public void configurationHolderNotInitialized() throws BusinessException, ClassCacheModificationException {
  List<String> definedIPs = mock(List.class);
  String agentName = "agentName";
  String version = "v1";
  when(registrationService.registerPlatformIdent(definedIPs, agentName, version)).thenReturn(ID);
  manager.register(definedIPs, agentName, version);
  when(configurationHolder.isInitialized()).thenReturn(false);
  Collection<JmxAttributeDescriptor> toMonitor = manager.analyzeJmxAttributes(ID, Collections.singleton(descriptor));
  assertThat(toMonitor, is(empty()));
}
origin: inspectIT/inspectIT

@Test
public void configurationHolderHasNoAppliers() throws BusinessException, ClassCacheModificationException {
  List<String> definedIPs = mock(List.class);
  String agentName = "agentName";
  String version = "v1";
  when(registrationService.registerPlatformIdent(definedIPs, agentName, version)).thenReturn(ID);
  manager.register(definedIPs, agentName, version);
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(configurationHolder.getJmxMonitoringAppliers()).thenReturn(null);
  Collection<JmxAttributeDescriptor> toMonitor = manager.analyzeJmxAttributes(ID, Collections.singleton(descriptor));
  assertThat(toMonitor, is(empty()));
}
origin: inspectIT/inspectIT

@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void futureThrowsExecutionException() throws InterruptedException, ExecutionException, TimeoutException {
  cacheMap.put(1L, cacheEntry);
  when(event.isProfileActive()).thenReturn(true);
  when(event.getProfileId()).thenReturn("id_1");
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(environment.getProfileIds()).thenReturn(Sets.newHashSet("id_1"));
  when(objectFactory.getObject()).thenReturn(updateJob);
  when(executor.submit(updateJob)).thenReturn((Future) future);
  when(future.get(1L, TimeUnit.MINUTES)).thenThrow(ExecutionException.class);
  eventListener.onApplicationEvent(event);
  verify(future).get(1L, TimeUnit.MINUTES);
}
origin: inspectIT/inspectIT

@Test
public void noEnvironment() {
  when(configurationHolder.isInitialized()).thenReturn(false);
  job.setEnvironment(null);
  job.run();
  verify(instrumentationService, times(1)).removeInstrumentationPoints();
  verify(configurationHolder, times(1)).update(null, PLATFORM_ID);
  verifyNoMoreInteractions(instrumentationService, eventPublisher);
}
origin: inspectIT/inspectIT

  @Test
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public void futureThrowsInterruptedException() throws InterruptedException, ExecutionException, TimeoutException {
    cacheMap.put(1L, cacheEntry);
    when(event.isProfileActive()).thenReturn(true);
    when(event.getProfileId()).thenReturn("id_1");
    when(configurationHolder.isInitialized()).thenReturn(true);
    when(environment.getProfileIds()).thenReturn(Sets.newHashSet("id_1"));
    when(objectFactory.getObject()).thenReturn(updateJob);
    when(executor.submit(updateJob)).thenReturn((Future) future);
    when(future.get(1L, TimeUnit.MINUTES)).thenThrow(InterruptedException.class);
    eventListener.onApplicationEvent(event);
    verify(future).get(1L, TimeUnit.MINUTES);
  }
}
origin: inspectIT/inspectIT

@Test
public void configurationNotInitialized() {
  cacheMap.put(1L, cacheEntry);
  when(event.isProfileActive()).thenReturn(true);
  when(event.getProfileId()).thenReturn("id_1");
  when(configurationHolder.isInitialized()).thenReturn(false);
  eventListener.onApplicationEvent(event);
  verify(event).isProfileActive();
  verify(nextGenInstrumentationManager).getAgentCacheMap();
  verify(cacheEntry).getConfigurationHolder();
  verify(configurationHolder).isInitialized();
  verifyNoMoreInteractions(event, cacheEntry, configurationHolder, nextGenInstrumentationManager);
  verifyZeroInteractions(environment, updateJob, future, objectFactory, executor);
}
origin: inspectIT/inspectIT

@Test
public void existingClassTypeConfigurationNotInitialized() throws BusinessException, ClassCacheModificationException {
  List<String> definedIPs = mock(List.class);
  String agentName = "agentName";
  String version = "v1";
  when(registrationService.registerPlatformIdent(definedIPs, agentName, version)).thenReturn(ID);
  manager.register(definedIPs, agentName, version);
  ClassType classType = mock(ClassType.class);
  when(classType.isClass()).thenReturn(true);
  when(classType.castToClass()).thenReturn(classType);
  when(lookupService.findByHash(HASH)).thenReturn(classType);
  when(configurationHolder.isInitialized()).thenReturn(false);
  InstrumentationDefinition result = manager.analyze(ID, HASH, type);
  assertThat(result, is(nullValue()));
  verifyZeroInteractions(modificationService, instrumentationService);
}
origin: inspectIT/inspectIT

@Test
public void applierDoesNothing() throws BusinessException, ClassCacheModificationException {
  List<String> definedIPs = mock(List.class);
  String agentName = "agentName";
  String version = "v1";
  when(registrationService.registerPlatformIdent(definedIPs, agentName, version)).thenReturn(ID);
  manager.register(definedIPs, agentName, version);
  AgentConfig configuration = mock(AgentConfig.class);
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(configurationHolder.getAgentConfiguration()).thenReturn(configuration);
  when(configurationHolder.getJmxMonitoringAppliers()).thenReturn(Collections.singleton(applier));
  when(applier.addMonitoringPoint(configuration, descriptor)).thenReturn(false);
  Collection<JmxAttributeDescriptor> toMonitor = manager.analyzeJmxAttributes(ID, Collections.singleton(descriptor));
  assertThat(toMonitor, is(empty()));
  verify(applier).addMonitoringPoint(configuration, descriptor);
}
origin: inspectIT/inspectIT

@Test
public void environmentsAreNotEqual() {
  cacheMap.put(1L, cacheEntry);
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(environment.getId()).thenReturn("id");
  when(event.getEnvironmentId()).thenReturn("otherId");
  eventListener.onApplicationEvent(event);
  verify(nextGenInstrumentationManager).getAgentCacheMap();
  verify(cacheEntry).getConfigurationHolder();
  verify(configurationHolder).isInitialized();
  verify(configurationHolder).getEnvironment();
  verify(environment).getId();
  verify(event).getEnvironmentId();
  verifyNoMoreInteractions(nextGenInstrumentationManager, cacheEntry, configurationHolder, environment, event);
  verifyZeroInteractions(objectFactory, updateJob, executor, future);
}
origin: inspectIT/inspectIT

@Test
public void applierAddsMonitoringPoint() throws BusinessException, ClassCacheModificationException {
  List<String> definedIPs = mock(List.class);
  String agentName = "agentName";
  String version = "v1";
  when(registrationService.registerPlatformIdent(definedIPs, agentName, version)).thenReturn(ID);
  manager.register(definedIPs, agentName, version);
  AgentConfig configuration = mock(AgentConfig.class);
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(configurationHolder.getAgentConfiguration()).thenReturn(configuration);
  when(configurationHolder.getJmxMonitoringAppliers()).thenReturn(Collections.singleton(applier));
  when(applier.addMonitoringPoint(configuration, descriptor)).thenReturn(true);
  Collection<JmxAttributeDescriptor> toMonitor = manager.analyzeJmxAttributes(ID, Collections.singleton(descriptor));
  assertThat(toMonitor, hasSize(1));
  assertThat(toMonitor, hasItem(descriptor));
  verify(applier).addMonitoringPoint(configuration, descriptor);
}
origin: inspectIT/inspectIT

@Test
public void ensureNoDoubleRegistration() throws BusinessException, ClassCacheModificationException {
  List<String> definedIPs = mock(List.class);
  String agentName = "agentName";
  String version = "v1";
  when(registrationService.registerPlatformIdent(definedIPs, agentName, version)).thenReturn(ID);
  manager.register(definedIPs, agentName, version);
  AgentConfig configuration = mock(AgentConfig.class);
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(configurationHolder.getAgentConfiguration()).thenReturn(configuration);
  List<JmxMonitoringApplier> appliers = new ArrayList<>();
  appliers.add(applier);
  appliers.add(applier);
  when(configurationHolder.getJmxMonitoringAppliers()).thenReturn(appliers);
  when(applier.addMonitoringPoint(configuration, descriptor)).thenReturn(true);
  Collection<JmxAttributeDescriptor> toMonitor = manager.analyzeJmxAttributes(ID, Collections.singleton(descriptor));
  assertThat(toMonitor, hasSize(1));
  assertThat(toMonitor, hasItem(descriptor));
  verify(applier).addMonitoringPoint(configuration, descriptor);
}
origin: inspectIT/inspectIT

@Test
@SuppressWarnings("unchecked")
public void emptyEnvironment() {
  cacheMap.put(1L, cacheEntry);
  when(event.isProfileActive()).thenReturn(true);
  when(event.getProfileId()).thenReturn("id_1");
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(environment.getProfileIds()).thenReturn(Collections.EMPTY_SET);
  eventListener.onApplicationEvent(event);
  verify(event).isProfileActive();
  verify(nextGenInstrumentationManager).getAgentCacheMap();
  verify(cacheEntry).getConfigurationHolder();
  verify(configurationHolder).getEnvironment();
  verify(configurationHolder).isInitialized();
  verify(environment).getProfileIds();
  verifyNoMoreInteractions(event, cacheEntry, configurationHolder, environment, nextGenInstrumentationManager);
  verifyZeroInteractions(updateJob, future, objectFactory, executor);
}
origin: inspectIT/inspectIT

@Test
public void unknownProfile() {
  cacheMap.put(1L, cacheEntry);
  when(event.isProfileActive()).thenReturn(true);
  when(event.getProfileId()).thenReturn("id_unknown");
  when(configurationHolder.isInitialized()).thenReturn(true);
  when(environment.getProfileIds()).thenReturn(Sets.newHashSet("id_1"));
  eventListener.onApplicationEvent(event);
  verify(event).isProfileActive();
  verify(event).getProfileId();
  verify(nextGenInstrumentationManager).getAgentCacheMap();
  verify(cacheEntry).getConfigurationHolder();
  verify(configurationHolder).getEnvironment();
  verify(configurationHolder).isInitialized();
  verify(environment, times(2)).getProfileIds();
  verifyNoMoreInteractions(event, cacheEntry, configurationHolder, environment, nextGenInstrumentationManager);
  verifyZeroInteractions(updateJob, future, objectFactory, executor);
}
origin: inspectIT/inspectIT

  @Test
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public void yesEnvironment() {
    when(configurationHolder.isInitialized()).thenReturn(true);
    when(configurationHolder.getAgentConfiguration()).thenReturn(updateConfiguration);
    doReturn(Collections.singletonList(classType)).when(instrumentationService).addInstrumentationPoints(any(AgentConfig.class), any(Collection.class));

    job.setEnvironment(updateEnvironment);
    job.run();

    verify(instrumentationService, times(1)).removeInstrumentationPoints();
    verify(configurationHolder, times(1)).update(updateEnvironment, PLATFORM_ID);

    Collection<IInstrumentationApplier> appliers = configurationHolder.getInstrumentationAppliers();
    verify(instrumentationService, times(1)).addInstrumentationPoints(updateConfiguration, appliers);

    ArgumentCaptor<Collection> typeCaptor = ArgumentCaptor.forClass(Collection.class);
    verify(instrumentationService).getInstrumentationResults(typeCaptor.capture());
    assertThat((Collection<Type>) typeCaptor.getValue(), hasItems((Type) classType));

    verify(eventPublisher).publishEvent(any(ClassInstrumentationChangedEvent.class));

    verifyNoMoreInteractions(instrumentationService, updateConfiguration, updateEnvironment, eventPublisher);
  }
}
origin: inspectIT/inspectIT

  @Test
  public void updateReset() {
    long platformId = 11;
    Environment environment = mock(Environment.class);
    AgentConfig configuration = mock(AgentConfig.class);
    IInstrumentationApplier applier = mock(IInstrumentationApplier.class);
    JmxMonitoringApplier jmxApplier = mock(JmxMonitoringApplier.class);
    when(configurationCreator.environmentToConfiguration(environment, platformId)).thenReturn(configuration);
    when(configurationResolver.getInstrumentationAppliers(environment)).thenReturn(Collections.singleton(applier));
    when(configurationResolver.getJmxMonitoringAppliers(environment)).thenReturn(Collections.singleton(jmxApplier));
    holder.update(environment, platformId);
    holder.update(null, platformId);
    assertThat(holder.isInitialized(), is(false));
    // only one time verifications
    verify(configurationCreator).environmentToConfiguration(environment, platformId);
    verify(configurationResolver).getInstrumentationAppliers(environment);
    verify(configurationResolver).getJmxMonitoringAppliers(environment);
    verifyNoMoreInteractions(configurationCreator, configurationResolver);
  }
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
protected Collection<ImmutableType> execute() {
  Collection<ImmutableType> changedClassTypes = new HashSet<>();
  // add current instrumentation
  changedClassTypes.addAll(getClassCache().getLookupService().findInstrumentedTypes());
  // first remove all existing instrumentation points
  getClassCache().getInstrumentationService().removeInstrumentationPoints();
  // then update configuration holder
  ConfigurationHolder configurationHolder = getConfigurationHolder();
  configurationHolder.update(environment, getAgentId());
  // if we are initialized analyze the complete class cache
  if (configurationHolder.isInitialized()) {
    // then add instrumentation points
    Collection<IInstrumentationApplier> instrumentationAppliers = configurationHolder.getInstrumentationAppliers();
    Collection<? extends ImmutableClassType> instrumentedTypes = getClassCache().getInstrumentationService().addInstrumentationPoints(getAgentConfiguration(), instrumentationAppliers);
    changedClassTypes.addAll(instrumentedTypes);
  }
  return changedClassTypes;
}
rocks.inspectit.server.instrumentation.configConfigurationHolderisInitialized

Javadoc

Returns if the configuration in this holder is properly initialized.

Popular methods of ConfigurationHolder

  • getAgentConfiguration
    Gets #agentConfiguration.
  • getEnvironment
    Gets #environment.
  • getInstrumentationAppliers
    Gets #instrumentationAppliers.
  • getJmxMonitoringAppliers
    Gets #jmxMonitoringAppliers.
  • update
    Updates the defined configuration in the holder with following tasks: 1. Creates the new #agentConfi

Popular in Java

  • Making http requests using okhttp
  • requestLocationUpdates (LocationManager)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • Path (java.nio.file)
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • JButton (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
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