Moved find device to its own utility method, and added a specific equals method and reworked some test.

This commit is contained in:
Ziver Koc 2021-03-23 01:57:12 +01:00
parent 7e8938c38c
commit c7e286f51e
166 changed files with 618 additions and 374 deletions

View file

@ -48,6 +48,7 @@
package se.hal.plugin.nutups;
import se.hal.intf.HalDeviceConfig;
import se.hal.intf.HalSensorConfig;
import se.hal.intf.HalSensorController;
import se.hal.intf.HalSensorData;
@ -86,17 +87,6 @@ public class NutUpsDevice implements HalSensorConfig{
return 60*1000; // 1 min
}
@Override
public boolean equals(Object obj){
if (obj instanceof NutUpsDevice)
return upsId != null && upsId.equals(((NutUpsDevice)obj).upsId);
return false;
}
public String toString(){
return "upsId: "+ upsId;
}
@Override
public AggregationMethod getAggregationMethod() {
return AggregationMethod.SUM;
@ -109,4 +99,16 @@ public class NutUpsDevice implements HalSensorConfig{
public Class<? extends HalSensorData> getDeviceDataClass() {
return PowerConsumptionSensorData.class;
}
@Override
public boolean equals(Object obj){
if (obj instanceof NutUpsDevice)
return upsId != null && upsId.equals(((NutUpsDevice)obj).upsId);
return false;
}
@Override
public String toString(){
return "upsId: "+ upsId;
}
}