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

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

Best Java code snippets using rocks.inspectit.server.dao.MethodSensorTypeIdentDao.saveOrUpdate (Showing top 3 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 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);
}
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);
  }
}
rocks.inspectit.server.daoMethodSensorTypeIdentDaosaveOrUpdate

Popular methods of MethodSensorTypeIdentDao

  • findIdByClassNameAndPlatformId
  • updateParameters

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
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