Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3eb3a718ca
|
@ -58,4 +58,8 @@ public class CentralSensorItemService implements SensorItemService {
|
|||
this.sensorItemDAO.deleteById(sensorItemID);
|
||||
}
|
||||
|
||||
public void removeAllBySensorID(Long sensorID) throws OverflowException {
|
||||
this.sensorItemDAO.deleteAll(this.readAllBySensorID(sensorID));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,8 +57,15 @@ public class CentralSensorService implements SensorService {
|
|||
@Transactional
|
||||
@Override
|
||||
public Sensor modify(Long sensorID, List<MetaDisplayItemMapping> metaDisplayItemMappings) throws OverflowException {
|
||||
// FIXME : not impl
|
||||
return null;
|
||||
Sensor sensor = this.read(sensorID);
|
||||
if (null == sensor) {
|
||||
throw new OverflowException(String.format("ID[%d] of Sensor is not valid", sensorID));
|
||||
}
|
||||
this.sensorItemService.readAllBySensorID(sensorID);
|
||||
for (MetaDisplayItemMapping metaDisplayItemMapping : metaDisplayItemMappings) {
|
||||
this.sensorItemService.regist(sensor, metaDisplayItemMapping);
|
||||
}
|
||||
return sensor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package com.loafle.overflow.central.module.sensor.service;
|
||||
|
||||
import com.loafle.overflow.central.module.meta.dao.MetaCrawlerMappingDAO;
|
||||
import com.loafle.overflow.central.module.meta.dao.MetaDisplayItemMappingDAO;
|
||||
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.loafle.overflow.model.meta.MetaCrawlerMapping;
|
||||
import com.loafle.overflow.model.sensor.Sensor;
|
||||
import com.loafle.overflow.model.target.Target;
|
||||
import com.loafle.overflow.service.central.sensor.SensorService;
|
||||
|
@ -30,9 +35,8 @@ public class SensorServiceTest {
|
|||
|
||||
@Autowired
|
||||
MetaDisplayItemMappingDAO metaDisplayItemMappingService;
|
||||
|
||||
@Autowired
|
||||
ObjectMapper objectMapper;
|
||||
MetaCrawlerMappingDAO metaCrawlerMappingDAO;
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
|
@ -42,7 +46,40 @@ public class SensorServiceTest {
|
|||
Sensor sensor = new Sensor();
|
||||
sensor.setTarget(target);
|
||||
|
||||
List<MetaCrawlerMapping> metaCrawlerMappings = this.metaCrawlerMappingDAO.findAll();
|
||||
sensor.setMetaCrawlerMapping(metaCrawlerMappings.get(0));
|
||||
|
||||
Sensor result = this.sensorService.regist(sensor, this.metaDisplayItemMappingService.findAll());
|
||||
Assert.assertNotNull(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void readAllByTargetID() throws Exception {
|
||||
this.regist();
|
||||
Assert.assertNotNull(this.sensorService.readAllByTargetID(Long.valueOf(1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void readAllByTargetIn() throws Exception {
|
||||
this.regist();
|
||||
List<Target> targets = new ArrayList<Target>();
|
||||
Target t1 = new Target();
|
||||
t1.setId(Long.valueOf(1));
|
||||
Target t2 = new Target();
|
||||
t2.setId(Long.valueOf(2));
|
||||
targets.add(t1);
|
||||
targets.add(t2);
|
||||
List<Sensor> sensors = this.sensorService.readAllByTargetIn(targets);
|
||||
Assert.assertNotNull(sensors);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void readAllByTargetInfraProbeID() throws Exception {
|
||||
this.regist();
|
||||
List<Sensor> sensors = this.sensorService.readAllByTargetInfraProbeID(Long.valueOf(1));
|
||||
Assert.assertNotNull(sensors);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user