Tabnine Logo
PlatformSensorTypeIdentDao.saveOrUpdate
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using rocks.inspectit.server.dao.PlatformSensorTypeIdentDao.saveOrUpdate (Showing top 2 results out of 315)

origin: inspectIT/inspectIT

  /**
   * Test the registration of the platform sensor type.
   */
  @Test
  public void registerPlatformSensorType() {
    final long platformSensorId = 20;
    long platformId = 1;
    final String fqcName = "class";
    when(platformSensorTypeIdentDao.findIdByClassNameAndPlatformId(fqcName, platformId)).thenReturn(Collections.<Long> emptyList());
    Mockito.doAnswer(new Answer<Object>() {
      @Override
      public Object answer(InvocationOnMock invocation) throws Throwable {
        PlatformSensorTypeIdent platformSensorTypeIdent = (PlatformSensorTypeIdent) invocation.getArguments()[0];
        platformSensorTypeIdent.setId(Long.valueOf(platformSensorId));
        platformSensorTypeIdent.setFullyQualifiedClassName(fqcName);
        return null;
      }
    }).when(platformSensorTypeIdentDao).saveOrUpdate((PlatformSensorTypeIdent) anyObject());
    long registeredId = registrationService.registerPlatformSensorTypeIdent(platformId, fqcName);
    assertThat(registeredId, is(equalTo(platformSensorId)));
    verify(platformIdentCache, times(1)).markDirty(platformId);
    ArgumentCaptor<PlatformSensorTypeIdent> platformSensorArgument = ArgumentCaptor.forClass(PlatformSensorTypeIdent.class);
    verify(platformSensorTypeIdentDao, times(1)).saveOrUpdate(platformSensorArgument.capture());
    assertThat(platformSensorArgument.getValue().getFullyQualifiedClassName(), is(equalTo(fqcName)));
    assertThat(platformSensorArgument.getValue().getPlatformIdent().getId(), is(equalTo(platformId)));
    verify(platformIdentCache, times(1)).markDirty(platformId);
  }
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
@MethodLog
public long registerPlatformSensorTypeIdent(long platformId, String fullyQualifiedClassName) {
  try {
    List<Long> platformSensorTypeIdentIds = platformSensorTypeIdentDao.findIdByClassNameAndPlatformId(fullyQualifiedClassName, platformId);
    if (1 == platformSensorTypeIdentIds.size()) {
      return platformSensorTypeIdentIds.get(0).longValue();
    } else {
      // only if it s not registered we need updating
      PlatformIdent platformIdent = new PlatformIdent();
      platformIdent.setId(platformId);
      PlatformSensorTypeIdent platformSensorTypeIdent = new PlatformSensorTypeIdent();
      platformSensorTypeIdent.setPlatformIdent(platformIdent);
      platformSensorTypeIdent.setFullyQualifiedClassName(fullyQualifiedClassName);
      platformSensorTypeIdentDao.saveOrUpdate(platformSensorTypeIdent);
      return platformSensorTypeIdent.getId();
    }
  } finally {
    platformIdentCache.markDirty(platformId);
  }
}
rocks.inspectit.server.daoPlatformSensorTypeIdentDaosaveOrUpdate

Javadoc

Saves or updates this PlatformSensorTypeIdent in the underlying storage.

Popular methods of PlatformSensorTypeIdentDao

  • findIdByClassNameAndPlatformId
    Find the PlatformSensorTypeIdent object IDs with given fully qualified sensor class name and platfor

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (ScheduledExecutorService)
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Join (org.hibernate.mapping)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now