Codota Logo
MethodSensorTypeIdentDao
Code IndexAdd Codota to your IDE (free)

How to use
MethodSensorTypeIdentDao
in
rocks.inspectit.server.dao

Best Java code snippets using rocks.inspectit.server.dao.MethodSensorTypeIdentDao (Showing top 4 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

/**
 * {@inheritDoc}
 */
@Override
@MethodLog
public long registerMethodSensorTypeIdent(long platformId, String fullyQualifiedClassName, Map<String, Object> parameters) {
  MethodSensorTypeIdent methodSensorTypeIdent;
  try {
    List<Long> methodSensorTypeIdents = methodSensorTypeIdentDao.findIdByClassNameAndPlatformId(fullyQualifiedClassName, platformId);
    if (1 == methodSensorTypeIdents.size()) {
      Long id = methodSensorTypeIdents.get(0);
      methodSensorTypeIdentDao.updateParameters(id, parameters);
      return id;
    } else {
      // only if the new sensor is registered we need to update the platform ident
      PlatformIdent platformIdent = new PlatformIdent();
      platformIdent.setId(platformId);
      methodSensorTypeIdent = new MethodSensorTypeIdent();
      methodSensorTypeIdent.setPlatformIdent(platformIdent);
      methodSensorTypeIdent.setFullyQualifiedClassName(fullyQualifiedClassName);
      methodSensorTypeIdent.setSettings(parameters);
      methodSensorTypeIdentDao.saveOrUpdate(methodSensorTypeIdent);
      return methodSensorTypeIdent.getId();
    }
  } finally {
    platformIdentCache.markDirty(platformId);
  }
}
origin: inspectIT/inspectIT

  /**
   * Test that the registration of the {@link MethodSensorTypeIdent} will be correct if
   * properties are provided.
   */
  @SuppressWarnings("unchecked")
  @Test
  public void registerExistingMethodSensorTypeWithSettings() {
    final long methodSensorId = 30;
    long platformId = 1;
    final String fqcName = "class";
    String regEx = "myRegEx";
    String regExTemplate = "myRegExTemplate";
    Map<String, Object> settings = MapUtils.putAll(new HashMap<String, Object>(), new String[][] { { "regEx", regEx }, { "regExTemplate", regExTemplate } });
    when(methodSensorTypeIdentDao.findIdByClassNameAndPlatformId(fqcName, platformId)).thenReturn(Collections.singletonList(methodSensorId));
    long registeredId = registrationService.registerMethodSensorTypeIdent(platformId, fqcName, settings);
    assertThat(registeredId, is(equalTo(methodSensorId)));
    verify(methodSensorTypeIdentDao, times(1)).updateParameters(methodSensorId, settings);
  }
}
origin: inspectIT/inspectIT

/**
 * Test that the registration of the {@link MethodSensorTypeIdent} will be correct if
 * properties are provided.
 */
@SuppressWarnings("unchecked")
@Test
public void registerMethodSensorTypeWithSettings() {
  final long methodSensorId = 30;
  long platformId = 1;
  final String fqcName = "class";
  String regEx = "myRegEx";
  String regExTemplate = "myRegExTemplate";
  Map<String, Object> settings = MapUtils.putAll(new HashMap<String, Object>(), new String[][] { { "regEx", regEx }, { "regExTemplate", regExTemplate } });
  when(methodSensorTypeIdentDao.findIdByClassNameAndPlatformId(fqcName, platformId)).thenReturn(Collections.<Long> emptyList());
  Mockito.doAnswer(new Answer<Object>() {
    @Override
    public Object answer(InvocationOnMock invocation) throws Throwable {
      MethodSensorTypeIdent methodSensorIdent = (MethodSensorTypeIdent) invocation.getArguments()[0];
      methodSensorIdent.setId(Long.valueOf(methodSensorId));
      methodSensorIdent.setFullyQualifiedClassName(fqcName);
      return null;
    }
  }).when(methodSensorTypeIdentDao).saveOrUpdate((MethodSensorTypeIdent) anyObject());
  long registeredId = registrationService.registerMethodSensorTypeIdent(platformId, fqcName, settings);
  assertThat(registeredId, is(equalTo(methodSensorId)));
  verify(platformIdentCache, times(1)).markDirty(platformId);
  ArgumentCaptor<MethodSensorTypeIdent> methodSensorArgument = ArgumentCaptor.forClass(MethodSensorTypeIdent.class);
  verify(methodSensorTypeIdentDao, times(1)).saveOrUpdate(methodSensorArgument.capture());
  assertThat(methodSensorArgument.getValue().getSettings(), is(settings));
}
origin: inspectIT/inspectIT

/**
 * Test the registration of the method sensor type.
 */
@Test
public void registerMethodSensorType() {
  final long methodSensorId = 30;
  long platformId = 1;
  final String fqcName = "class";
  when(methodSensorTypeIdentDao.findIdByClassNameAndPlatformId(fqcName, platformId)).thenReturn(Collections.<Long> emptyList());
  Mockito.doAnswer(new Answer<Object>() {
    @Override
    public Object answer(InvocationOnMock invocation) throws Throwable {
      MethodSensorTypeIdent methodSensorIdent = (MethodSensorTypeIdent) invocation.getArguments()[0];
      methodSensorIdent.setId(Long.valueOf(methodSensorId));
      methodSensorIdent.setFullyQualifiedClassName(fqcName);
      return null;
    }
  }).when(methodSensorTypeIdentDao).saveOrUpdate((MethodSensorTypeIdent) anyObject());
  long registeredId = registrationService.registerMethodSensorTypeIdent(platformId, fqcName, Collections.<String, Object> emptyMap());
  assertThat(registeredId, is(equalTo(methodSensorId)));
  verify(platformIdentCache, times(1)).markDirty(platformId);
  ArgumentCaptor<MethodSensorTypeIdent> methodSensorArgument = ArgumentCaptor.forClass(MethodSensorTypeIdent.class);
  verify(methodSensorTypeIdentDao, times(1)).saveOrUpdate(methodSensorArgument.capture());
  assertThat(methodSensorArgument.getValue().getFullyQualifiedClassName(), is(equalTo(fqcName)));
  assertThat(methodSensorArgument.getValue().getPlatformIdent().getId(), is(equalTo(platformId)));
  verify(platformIdentCache, times(1)).markDirty(platformId);
}
rocks.inspectit.server.daoMethodSensorTypeIdentDao

Most used methods

  • findIdByClassNameAndPlatformId
  • saveOrUpdate
  • updateParameters

Popular in Java

  • Updating database using SQL prepared statement
  • getContentResolver (Context)
  • setContentView (Activity)
  • getExternalFilesDir (Context)
  • IOException (java.io)
    Signals that an I/O exception of some sort has occurred. This class is the general class of exceptio
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
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