sensorconfigtest succeed

This commit is contained in:
insanity 2018-06-29 18:53:46 +09:00
parent ee5f6ddd99
commit 09deab40db
2 changed files with 6 additions and 3 deletions

View File

@ -3,6 +3,8 @@ package com.loafle.overflow.central.module.sensor.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.transaction.Transactional;
import com.loafle.overflow.core.exception.OverflowException; import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.Infra; import com.loafle.overflow.model.infra.Infra;
import com.loafle.overflow.model.infra.InfraHost; import com.loafle.overflow.model.infra.InfraHost;
@ -22,7 +24,6 @@ import com.loafle.overflow.model.sensorconfig.SensorConfigItems;
import com.loafle.overflow.model.sensorconfig.SensorConfigSchedule; import com.loafle.overflow.model.sensorconfig.SensorConfigSchedule;
import com.loafle.overflow.service.central.meta.MetaCollectionItemMappingService; import com.loafle.overflow.service.central.meta.MetaCollectionItemMappingService;
import org.hibernate.mapping.Array;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -34,6 +35,7 @@ public class CentralSensorConfigService {
@Autowired @Autowired
CentralSensorItemService sensorItemService; CentralSensorItemService sensorItemService;
@Transactional
public SensorConfig regist(Sensor sensor) throws OverflowException { public SensorConfig regist(Sensor sensor) throws OverflowException {
if (null == sensor.getId()) { if (null == sensor.getId()) {
throw new OverflowException(String.format("ID[%s] of Sensor is not valid", sensor.getId())); throw new OverflowException(String.format("ID[%s] of Sensor is not valid", sensor.getId()));
@ -73,9 +75,9 @@ public class CentralSensorConfigService {
MetaCryptoType metaCryptoType = null; MetaCryptoType metaCryptoType = null;
; ;
if (metaInfraType.getKey() == "HOST") { if (metaInfraType.getKey().equals("HOST")) {
infraHostIP = ((InfraHost) infra).getInfraHostIPs().get(0); infraHostIP = ((InfraHost) infra).getInfraHostIPs().get(0);
} else if (metaInfraType.getKey() == "SERVICE") { } else if (metaInfraType.getKey().equals("SERVICE")) {
infraHostIP = ((InfraService) infra).getInfraHostPort().getInfraHostIP(); infraHostIP = ((InfraService) infra).getInfraHostPort().getInfraHostIP();
infraHostPort = ((InfraService) infra).getInfraHostPort(); infraHostPort = ((InfraService) infra).getInfraHostPort();
metaCryptoType = ((InfraService) infra).getMetaCryptoType(); metaCryptoType = ((InfraService) infra).getMetaCryptoType();

View File

@ -81,6 +81,7 @@ public class CentralSensorService implements SensorService {
this.sensorItemService.regist(retSensor, metaDisplayItemMapping); this.sensorItemService.regist(retSensor, metaDisplayItemMapping);
} }
// FiXME : process asynchronously
this.sensorConfigService.regist(retSensor); this.sensorConfigService.regist(retSensor);
return retSensor; return retSensor;