/** * Initializes the {@link SystemSensorData}. */ private void initSensorData() { SystemSensorData systemSensorData = this.getSystemSensorData(); systemSensorData.setPlatformIdent(this.platformManager.getPlatformId()); systemSensorData.setSensorTypeIdent(sensorTypeConfig.getId()); }
@Test void initExistingPlatformSensorData() throws Exception { PlatformSensorTypeConfig platformSensorTypeConfigA = Mockito.mock(PlatformSensorTypeConfig.class); when(platformSensorTypeConfigA.getClassName()).thenReturn("rocks.inspectit.agent.java.sensor.platform.AbstractPlatformSensorFakeImpl"); when(this.configurationStorage.getPlatformSensorTypes()).thenReturn(Arrays.asList(platformSensorTypeConfigA)); when(this.platformManager.getPlatformId()).thenReturn(1337L); when(platformSensorTypeConfigA.getId()).thenReturn(73L); this.cut.afterPropertiesSet(); SystemSensorData systemSensorData = this.cut.getSystemSensorData(); verify(systemSensorData).setPlatformIdent(1337L); verify(systemSensorData).setSensorTypeIdent(73L); }
/** * Constructor. * * @param jmxDefinitionDataIdentId * the id of the related {@link JmxDefinitionDataIdent} of this * {@link JmxSensorValueData} * @param value * the value * @param timestamp * the timestamp when this value was captured * @param platformIdent * the id of the related {@link PlatformIdent} * @param sensorTypeIdent * the id of the related {@link SensorTypeIdent} */ public JmxSensorValueData(long jmxDefinitionDataIdentId, String value, Timestamp timestamp, long platformIdent, long sensorTypeIdent) { setJmxSensorDefinitionDataIdentId(jmxDefinitionDataIdentId); setValue(value); super.setTimeStamp(timestamp); super.setPlatformIdent(platformIdent); super.setSensorTypeIdent(sensorTypeIdent); super.setId(jmxDefinitionDataIdentId); }