use of com.vmware.flowgate.poweriqworker.model.Sensor in project flowgate by vmware.
the class SyncSensorMetaDataJobTest method testGetSensorRealTimeData1.
@Test
public void testGetSensorRealTimeData1() {
HashMap<String, String> justificationfields = generateExtraInfo("6566");
Asset asset = createAsset();
asset.setId("123o89qw4jjasd0");
asset.setJustificationfields(justificationfields);
Sensor sensor = createSensor();
sensor.setId(6566);
sensor.setName("HumiditySensor");
sensor.setSerialNumber("8999");
sensor.setType("HumiditySensor");
Mockito.when(this.powerIQAPIClient.getSensorById("6566")).thenReturn(sensor);
List<Asset> assets = new ArrayList<Asset>();
assets.add(asset);
List<RealTimeData> realTimeDatas = powerIQService.getSensorRealTimeData(createFacility(), assets);
TestCase.assertEquals(0, realTimeDatas.size());
}
use of com.vmware.flowgate.poweriqworker.model.Sensor in project flowgate by vmware.
the class SyncSensorMetaDataJobTest method createSensor.
Sensor createSensor() {
Sensor sensor = new Sensor();
Parent parent = new Parent();
parent.setId(2);
parent.setType("rack");
sensor.setParent(parent);
return sensor;
}
use of com.vmware.flowgate.poweriqworker.model.Sensor in project flowgate by vmware.
the class SyncSensorMetaDataJobTest method testGetSensorRealTimeData2.
@Test
public void testGetSensorRealTimeData2() {
HashMap<String, String> justificationfields = generateExtraInfo("6566");
Asset asset = createAsset();
asset.setId("123o89qw4jjasd0");
asset.setJustificationfields(justificationfields);
HashMap<String, String> justificationfields1 = generateExtraInfo("6567");
Asset asset1 = createAsset();
asset1.setId("123o89qw4jjasd1");
asset1.setJustificationfields(justificationfields1);
Sensor sensor = createSensor();
SensorReading sensorReading = createReading();
sensorReading.setUom("%");
sensor.setId(6566);
sensor.setName("HumiditySensor");
sensor.setSerialNumber("8999");
sensor.setType("HumiditySensor");
sensor.setReading(sensorReading);
Mockito.when(this.powerIQAPIClient.getSensorById("6566")).thenReturn(sensor);
Sensor sensor1 = createSensor();
SensorReading sensorReading1 = createReading();
sensorReading1.setUom("F");
sensor1.setId(6567);
sensor1.setName("TemperatureSensor");
sensor1.setSerialNumber("9000");
sensor1.setType("TemperatureSensor");
sensor1.setReading(sensorReading1);
Mockito.when(this.powerIQAPIClient.getSensorById("6567")).thenReturn(sensor1);
Set<String> assetIds = new HashSet<String>();
assetIds.add("123o89qw4jjasd0");
assetIds.add("123o89qw4jjasd1");
List<Asset> assets = new ArrayList<Asset>();
assets.add(asset);
assets.add(asset1);
List<RealTimeData> realTimeDatas = powerIQService.getSensorRealTimeData(createFacility(), assets);
for (RealTimeData realtimedata : realTimeDatas) {
if ("123o89qw4jjasd0".equals(realtimedata.getAssetID())) {
TestCase.assertEquals((double) 100, realtimedata.getValues().get(0).getValueNum());
} else {
TestCase.assertEquals((double) (100 - 32) * 5 / 9, realtimedata.getValues().get(0).getValueNum());
}
}
}
use of com.vmware.flowgate.poweriqworker.model.Sensor in project flowgate by vmware.
the class SyncSensorMetaDataJobTest method getSensors.
List<Sensor> getSensors() {
List<Sensor> sensors = new ArrayList<Sensor>();
Sensor sensor = createSensor();
sensor.setId(6566);
sensor.setName("HumiditySensor");
sensor.setSerialNumber("8999");
sensor.setType("HumiditySensor");
sensors.add(sensor);
Sensor sensor1 = createSensor();
sensor1.setId(7878);
sensor1.setSerialNumber("5487");
sensor1.setName("TemperatureSensor01");
sensor1.setType("TemperatureSensor");
sensor1.setPduId(2L);
sensors.add(sensor1);
return sensors;
}
use of com.vmware.flowgate.poweriqworker.model.Sensor in project flowgate by vmware.
the class SyncSensorMetaDataJobTest method testAggregatorSensorIdAndSourceForPdu3.
@Test
public void testAggregatorSensorIdAndSourceForPdu3() {
Asset pdu = createAsset1();
HashMap<String, String> justificationfields = new HashMap<String, String>();
justificationfields.put(AssetSubCategory.Temperature.toString(), "509_l9i8728d55368540fcba1692");
pdu.setJustificationfields(justificationfields);
Sensor sensor = new Sensor();
sensor.setId(606);
sensor.setType(PowerIQService.HumiditySensor);
String source = "l9i8728d55368540fcba1692";
pdu = powerIQService.aggregatorSensorIdAndSourceForPdu(pdu, sensor, source);
TestCase.assertEquals(sensor.getId() + FlowgateConstant.SEPARATOR + source, pdu.getJustificationfields().get(AssetSubCategory.Humidity.toString()));
}
Aggregations