From 09deab40db93308dcf5b022072603eff05ec8ca3 Mon Sep 17 00:00:00 2001 From: insanity Date: Fri, 29 Jun 2018 18:53:46 +0900 Subject: [PATCH] sensorconfigtest succeed --- .../module/sensor/service/CentralSensorConfigService.java | 8 +++++--- .../module/sensor/service/CentralSensorService.java | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorConfigService.java b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorConfigService.java index 42acb2f..8d78671 100644 --- a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorConfigService.java +++ b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorConfigService.java @@ -3,6 +3,8 @@ package com.loafle.overflow.central.module.sensor.service; import java.util.ArrayList; import java.util.List; +import javax.transaction.Transactional; + import com.loafle.overflow.core.exception.OverflowException; import com.loafle.overflow.model.infra.Infra; 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.service.central.meta.MetaCollectionItemMappingService; -import org.hibernate.mapping.Array; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -34,6 +35,7 @@ public class CentralSensorConfigService { @Autowired CentralSensorItemService sensorItemService; + @Transactional public SensorConfig regist(Sensor sensor) throws OverflowException { if (null == 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; ; - if (metaInfraType.getKey() == "HOST") { + if (metaInfraType.getKey().equals("HOST")) { infraHostIP = ((InfraHost) infra).getInfraHostIPs().get(0); - } else if (metaInfraType.getKey() == "SERVICE") { + } else if (metaInfraType.getKey().equals("SERVICE")) { infraHostIP = ((InfraService) infra).getInfraHostPort().getInfraHostIP(); infraHostPort = ((InfraService) infra).getInfraHostPort(); metaCryptoType = ((InfraService) infra).getMetaCryptoType(); diff --git a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java index 377d643..22d399b 100644 --- a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java +++ b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java @@ -81,6 +81,7 @@ public class CentralSensorService implements SensorService { this.sensorItemService.regist(retSensor, metaDisplayItemMapping); } + // FiXME : process asynchronously this.sensorConfigService.regist(retSensor); return retSensor;