default sensor test succeed

This commit is contained in:
insanity 2018-06-29 16:38:20 +09:00
parent dc5d5aa56d
commit d8c8101dba
3 changed files with 10 additions and 3 deletions

View File

@ -25,11 +25,16 @@ public class CentralSensorItemService implements SensorItemService {
@Autowired @Autowired
private CentralSensorService sensorService; private CentralSensorService sensorService;
@Transactional
public SensorItem regist(Sensor sensor, MetaDisplayItemMapping metaDisplayItemMapping) throws OverflowException { public SensorItem regist(Sensor sensor, MetaDisplayItemMapping metaDisplayItemMapping) throws OverflowException {
SensorItem sensorItem = new SensorItem(); SensorItem sensorItem = new SensorItem();
sensorItem.setMetaDisplayItemMapping(metaDisplayItemMapping); sensorItem.setMetaDisplayItemMapping(metaDisplayItemMapping);
sensorItem.setSensor(sensor); sensorItem.setSensor(sensor);
return this.sensorItemDAO.save(sensorItem); SensorItem retSensorItem = this.sensorItemDAO.save(sensorItem);
if (null != retSensorItem) {
this.sensorService.increaseSensorItemCount(sensor.getId());
}
return retSensorItem;
} }
@Override @Override

View File

@ -37,6 +37,7 @@ public class CentralSensorService implements SensorService {
@Autowired @Autowired
private CentralSensorConfigService sensorConfigService; private CentralSensorConfigService sensorConfigService;
@Transactional
public void registDefaults(List<Target> targets) throws OverflowException { public void registDefaults(List<Target> targets) throws OverflowException {
for (Target target : targets) { for (Target target : targets) {
this.registDefault(target); this.registDefault(target);

View File

@ -44,9 +44,10 @@ public class SensorServiceTest {
InfraService infraService; InfraService infraService;
@Test @Test
@Ignore
public void registDefault() throws Exception { public void registDefault() throws Exception {
Long tempInfraID = Long.valueOf(1); Long tempInfraID = Long.valueOf(28); // ssh
Long tempProbeID = Long.valueOf(1); Long tempProbeID = Long.valueOf(3);
Infra infra = this.infraService.read(tempInfraID); Infra infra = this.infraService.read(tempInfraID);
List<Long> infraIDs = new ArrayList<>(); List<Long> infraIDs = new ArrayList<>();