ing
This commit is contained in:
parent
9c5ee4fb4b
commit
727b32b78b
|
@ -12,8 +12,8 @@ import com.loafle.overflow.model.sensorconfig.Schedule;
|
||||||
import com.loafle.overflow.model.sensorconfig.SensorConfig;
|
import com.loafle.overflow.model.sensorconfig.SensorConfig;
|
||||||
import com.loafle.overflow.model.sensorconfig.Target;
|
import com.loafle.overflow.model.sensorconfig.Target;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.codehaus.jackson.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -61,8 +61,10 @@ public class InfraHostGenerator {
|
||||||
|
|
||||||
Map<Integer, MetaSensorItemKey> keyMap = this.generateUtil.initMappingMap(dbSensor.getMetaCrawler());
|
Map<Integer, MetaSensorItemKey> keyMap = this.generateUtil.initMappingMap(dbSensor.getMetaCrawler());
|
||||||
|
|
||||||
// if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
|
// if (dbSensor.getMetaCrawler().getId() ==
|
||||||
// this.infraHostWMIGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
|
// MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
|
||||||
|
// this.infraHostWMIGenerator.process(sensorItems, keyMap, dbSensor,
|
||||||
|
// sensorConfig);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return objectMapper.writeValueAsString(sensorConfig);
|
return objectMapper.writeValueAsString(sensorConfig);
|
||||||
|
@ -70,33 +72,36 @@ public class InfraHostGenerator {
|
||||||
|
|
||||||
private Target createTarget(InfraHost infraHost, Sensor dbSensor) throws Exception {
|
private Target createTarget(InfraHost infraHost, Sensor dbSensor) throws Exception {
|
||||||
|
|
||||||
// AuthCrawler authCrawler = this.authCrawlerService.readByMetaCrawlerIDAndTargetID(dbSensor.getMetaCrawler().getId(),
|
// AuthCrawler authCrawler =
|
||||||
// dbSensor.getTarget().getId());
|
// this.authCrawlerService.readByMetaCrawlerIDAndTargetID(dbSensor.getMetaCrawler().getId(),
|
||||||
|
// dbSensor.getTarget().getId());
|
||||||
|
|
||||||
// if (authCrawler == null) {
|
// if (authCrawler == null) {
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Target target = new Target();
|
// Target target = new Target();
|
||||||
// Connection connection = new Connection();
|
// Connection connection = new Connection();
|
||||||
// // connection.setIp(infraHost.getIpv4());
|
// // connection.setIp(infraHost.getIpv4());
|
||||||
|
|
||||||
// HashMap<String, String> optionMap = this.objectMapper.readValue(authCrawler.getAuthJson(),
|
// HashMap<String, String> optionMap =
|
||||||
// new TypeReference<Map<String, String>>() {
|
// this.objectMapper.readValue(authCrawler.getAuthJson(),
|
||||||
// });
|
// new TypeReference<Map<String, String>>() {
|
||||||
|
// });
|
||||||
|
|
||||||
// if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
|
// if (dbSensor.getMetaCrawler().getId() ==
|
||||||
// connection.setPort(135);
|
// MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
|
||||||
// connection.setPortType(PortType.TCP);
|
// connection.setPort(135);
|
||||||
// connection.setSsl(false);
|
// connection.setPortType(PortType.TCP);
|
||||||
|
// connection.setSsl(false);
|
||||||
|
|
||||||
// target.setConnection(connection);
|
// target.setConnection(connection);
|
||||||
|
|
||||||
// Map<String, Object> auth = new HashMap<>();
|
// Map<String, Object> auth = new HashMap<>();
|
||||||
// auth.put("id", optionMap.get("ID"));
|
// auth.put("id", optionMap.get("ID"));
|
||||||
// auth.put("pw", optionMap.get("PassWord"));
|
// auth.put("pw", optionMap.get("PassWord"));
|
||||||
|
|
||||||
// target.setAuth(auth);
|
// target.setAuth(auth);
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ import com.loafle.overflow.model.sensorconfig.MappingInfo;
|
||||||
import com.loafle.overflow.model.sensorconfig.QueryInfo;
|
import com.loafle.overflow.model.sensorconfig.QueryInfo;
|
||||||
import com.loafle.overflow.model.sensorconfig.SensorConfig;
|
import com.loafle.overflow.model.sensorconfig.SensorConfig;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.codehaus.jackson.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ import com.loafle.overflow.model.sensorconfig.SensorConfig;
|
||||||
import com.loafle.overflow.model.sensorconfig.Target;
|
import com.loafle.overflow.model.sensorconfig.Target;
|
||||||
import com.loafle.overflow.service.central.auth.AuthCrawlerService;
|
import com.loafle.overflow.service.central.auth.AuthCrawlerService;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.codehaus.jackson.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -64,10 +64,14 @@ public class InfraServiceGenerator {
|
||||||
|
|
||||||
Map<Integer, MetaSensorItemKey> keyMap = this.generateUtil.initMappingMap(dbSensor.getMetaCrawler());
|
Map<Integer, MetaSensorItemKey> keyMap = this.generateUtil.initMappingMap(dbSensor.getMetaCrawler());
|
||||||
|
|
||||||
// if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
|
// if (dbSensor.getMetaCrawler().getId() ==
|
||||||
// this.infraServiceMysqlGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
|
// MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
|
||||||
// } else if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
// this.infraServiceMysqlGenerator.process(sensorItems, keyMap, dbSensor,
|
||||||
// this.infraServiceJMXGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
|
// sensorConfig);
|
||||||
|
// } else if (dbSensor.getMetaCrawler().getId() ==
|
||||||
|
// MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
||||||
|
// this.infraServiceJMXGenerator.process(sensorItems, keyMap, dbSensor,
|
||||||
|
// sensorConfig);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return objectMapper.writeValueAsString(sensorConfig);
|
return objectMapper.writeValueAsString(sensorConfig);
|
||||||
|
@ -75,11 +79,12 @@ public class InfraServiceGenerator {
|
||||||
|
|
||||||
private Target createTarget(InfraService infraService, Sensor sensor) throws Exception {
|
private Target createTarget(InfraService infraService, Sensor sensor) throws Exception {
|
||||||
|
|
||||||
// AuthCrawler authCrawler = this.authCrawlerService.readByMetaCrawlerIDAndTargetID(sensor.getMetaCrawler().getId(),
|
// AuthCrawler authCrawler =
|
||||||
// sensor.getTarget().getId());
|
// this.authCrawlerService.readByMetaCrawlerIDAndTargetID(sensor.getMetaCrawler().getId(),
|
||||||
|
// sensor.getTarget().getId());
|
||||||
|
|
||||||
// if (authCrawler == null) {
|
// if (authCrawler == null) {
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Target target = new Target();
|
// Target target = new Target();
|
||||||
|
@ -91,20 +96,24 @@ public class InfraServiceGenerator {
|
||||||
|
|
||||||
// target.setConnection(connection);
|
// target.setConnection(connection);
|
||||||
|
|
||||||
// HashMap<String, String> optionMap = this.objectMapper.readValue(authCrawler.getAuthJson(),
|
// HashMap<String, String> optionMap =
|
||||||
// new TypeReference<Map<String, String>>() {
|
// this.objectMapper.readValue(authCrawler.getAuthJson(),
|
||||||
// });
|
// new TypeReference<Map<String, String>>() {
|
||||||
|
// });
|
||||||
|
|
||||||
// Map<String, Object> auth = new HashMap<>();
|
// Map<String, Object> auth = new HashMap<>();
|
||||||
|
|
||||||
// // if (sensor.getMetaCrawler().getId() == MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
|
// // if (sensor.getMetaCrawler().getId() ==
|
||||||
// // auth.put("url", "jdbc:mysql://" + infraService.getInfraHost().getIpv4() + ":" + infraService.getPort());
|
// MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
|
||||||
// // auth.put("id", optionMap.get("ID")); // FIXME: Auth Info
|
// // auth.put("url", "jdbc:mysql://" + infraService.getInfraHost().getIpv4() +
|
||||||
// // auth.put("pw", optionMap.get("PassWord")); // FIXME: Auth Info
|
// ":" + infraService.getPort());
|
||||||
// // } else if (sensor.getMetaCrawler().getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
// // auth.put("id", optionMap.get("ID")); // FIXME: Auth Info
|
||||||
// // auth.put("id", optionMap.get("ID")); // FIXME: Auth Info
|
// // auth.put("pw", optionMap.get("PassWord")); // FIXME: Auth Info
|
||||||
// // auth.put("pw", optionMap.get("PassWord")); // FIXME: Auth Info
|
// // } else if (sensor.getMetaCrawler().getId() ==
|
||||||
// // connection.setPort(9840);
|
// MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
||||||
|
// // auth.put("id", optionMap.get("ID")); // FIXME: Auth Info
|
||||||
|
// // auth.put("pw", optionMap.get("PassWord")); // FIXME: Auth Info
|
||||||
|
// // connection.setPort(9840);
|
||||||
// // }
|
// // }
|
||||||
|
|
||||||
// target.setAuth(auth);
|
// target.setAuth(auth);
|
||||||
|
|
|
@ -9,8 +9,8 @@ import com.loafle.overflow.model.sensorconfig.MappingInfo;
|
||||||
import com.loafle.overflow.model.sensorconfig.QueryInfo;
|
import com.loafle.overflow.model.sensorconfig.QueryInfo;
|
||||||
import com.loafle.overflow.model.sensorconfig.SensorConfig;
|
import com.loafle.overflow.model.sensorconfig.SensorConfig;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.codehaus.jackson.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ import com.loafle.overflow.model.sensorconfig.MappingInfo;
|
||||||
import com.loafle.overflow.model.sensorconfig.QueryInfo;
|
import com.loafle.overflow.model.sensorconfig.QueryInfo;
|
||||||
import com.loafle.overflow.model.sensorconfig.SensorConfig;
|
import com.loafle.overflow.model.sensorconfig.SensorConfig;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.codehaus.jackson.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.loafle.overflow.service.central.noauthprobe.NoAuthProbeService;
|
||||||
import com.loafle.overflow.service.central.probe.ProbeHostService;
|
import com.loafle.overflow.service.central.probe.ProbeHostService;
|
||||||
import com.loafle.overflow.service.central.probe.ProbeService;
|
import com.loafle.overflow.service.central.probe.ProbeService;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
|
@ -4,8 +4,8 @@ import com.google.gson.internal.Primitives;
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
import com.loafle.overflow.core.exception.OverflowException;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.codehaus.jackson.type.JavaType;
|
import com.fasterxml.jackson.databind.JavaType;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.loafle.overflow.core.model.PublishMessage;
|
||||||
import com.loafle.overflow.model.member.Member;
|
import com.loafle.overflow.model.member.Member;
|
||||||
import com.loafle.overflow.service.central.member.MemberService;
|
import com.loafle.overflow.service.central.member.MemberService;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.loafle.overflow.central.spring;
|
package com.loafle.overflow.central.spring;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.DeserializationConfig;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.springframework.context.annotation.*;
|
import org.springframework.context.annotation.*;
|
||||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class AppConfig {
|
||||||
@Bean
|
@Bean
|
||||||
public ObjectMapper getObjectMapper() {
|
public ObjectMapper getObjectMapper() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
return objectMapper;
|
return objectMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
||||||
import com.loafle.overflow.central.spring.AppConfigTest;
|
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||||
import com.loafle.overflow.model.infra.InfraHost;
|
import com.loafle.overflow.model.infra.InfraHost;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// import com.loafle.overflow.central.module.sensor.model.Sensor;
|
// import com.loafle.overflow.central.module.sensor.model.Sensor;
|
||||||
// import com.loafle.overflow.central.module.target.model.Target;
|
// import com.loafle.overflow.central.module.target.model.Target;
|
||||||
// import com.loafle.overflow.central.spring.AppConfigTest;
|
// import com.loafle.overflow.central.spring.AppConfigTest;
|
||||||
// import org.codehaus.jackson.map.ObjectMapper;
|
// import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
// import org.junit.Assert;
|
// import org.junit.Assert;
|
||||||
// import org.junit.Ignore;
|
// import org.junit.Ignore;
|
||||||
// import org.junit.Test;
|
// import org.junit.Test;
|
||||||
|
@ -20,123 +20,122 @@
|
||||||
// import java.util.Map;
|
// import java.util.Map;
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Created by insanity on 17. 6. 28.
|
// * Created by insanity on 17. 6. 28.
|
||||||
// */
|
// */
|
||||||
// //@Ignore
|
// //@Ignore
|
||||||
// @RunWith(SpringJUnit4ClassRunner.class)
|
// @RunWith(SpringJUnit4ClassRunner.class)
|
||||||
// @ContextConfiguration(classes = {AppConfigTest.class})
|
// @ContextConfiguration(classes = {AppConfigTest.class})
|
||||||
// public class SensorServiceTest {
|
// public class SensorServiceTest {
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// SensorService sensorService;
|
// SensorService sensorService;
|
||||||
|
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// ObjectMapper objectMapper;
|
// ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
// @Ignore
|
||||||
|
// @Test
|
||||||
|
// public void regist() throws Exception {
|
||||||
|
// Sensor sensor = new Sensor();
|
||||||
|
// MetaSensorStatus status = new MetaSensorStatus((short)1);
|
||||||
|
// sensor.setStatus(status);
|
||||||
|
// MetaCrawler crawler = new MetaCrawler();
|
||||||
|
// crawler.setId((short)1);
|
||||||
|
// sensor.setCrawler(crawler);
|
||||||
|
// Target target = new Target();
|
||||||
|
// target.setId(1);
|
||||||
|
// sensor.setTarget(target);
|
||||||
|
// sensor.setCreateDate(new Date());
|
||||||
|
|
||||||
// @Ignore
|
// Sensor res = this.sensorService.regist(sensor);
|
||||||
// @Test
|
// Assert.assertNotNull(res);
|
||||||
// public void regist() throws Exception {
|
// }
|
||||||
// Sensor sensor = new Sensor();
|
|
||||||
// MetaSensorStatus status = new MetaSensorStatus((short)1);
|
// @Test
|
||||||
// sensor.setStatus(status);
|
// public void read() throws Exception {
|
||||||
// MetaCrawler crawler = new MetaCrawler();
|
// Sensor res = this.sensorService.read("1");
|
||||||
// crawler.setId((short)1);
|
// Assert.assertNotNull(res);
|
||||||
// sensor.setCrawler(crawler);
|
|
||||||
// Target target = new Target();
|
// ObjectMapper objectMapper = new ObjectMapper();
|
||||||
// target.setId(1);
|
|
||||||
// sensor.setTarget(target);
|
// // String json = objectMapper.writeValueAsString(res);
|
||||||
// sensor.setCreateDate(new Date());
|
|
||||||
|
// String json = this.objectMapper.writeValueAsString(res);
|
||||||
// Sensor res = this.sensorService.regist(sensor);
|
|
||||||
// Assert.assertNotNull(res);
|
// System.out.println(json);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
// public void read() throws Exception {
|
// public void generateSensorConfig() throws IOException {
|
||||||
// Sensor res = this.sensorService.read("1");
|
|
||||||
// Assert.assertNotNull(res);
|
// Sensor sensor = new Sensor();
|
||||||
|
// sensor.setId(5);
|
||||||
// ObjectMapper objectMapper = new ObjectMapper();
|
// String result = this.sensorService.generateSensorConfig(sensor);
|
||||||
|
|
||||||
// // String json = objectMapper.writeValueAsString(res);
|
// System.out.println(result);
|
||||||
|
|
||||||
// String json = this.objectMapper.writeValueAsString(res);
|
// }
|
||||||
|
|
||||||
// System.out.println(json);
|
// @Test
|
||||||
// }
|
// public void testJsonToMap() throws IOException {
|
||||||
|
|
||||||
// @Test
|
// String json = "{\"interval\":5}";
|
||||||
// public void generateSensorConfig() throws IOException {
|
|
||||||
|
// ObjectMapper objectMapper = new ObjectMapper();
|
||||||
// Sensor sensor = new Sensor();
|
|
||||||
// sensor.setId(5);
|
// Map<String, Object> mm = new HashMap<>();
|
||||||
// String result = this.sensorService.generateSensorConfig(sensor);
|
|
||||||
|
// mm = objectMapper.readValue(json, HashMap.class);
|
||||||
// System.out.println(result);
|
|
||||||
|
// System.out.println(mm.get("interval"));
|
||||||
// }
|
|
||||||
|
// }
|
||||||
// @Test
|
|
||||||
// public void testJsonToMap() throws IOException {
|
// @Test
|
||||||
|
// public void stringbbb() {
|
||||||
// String json = "{\"interval\":5}";
|
// StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
|
||||||
// ObjectMapper objectMapper = new ObjectMapper();
|
// stringBuffer.append("222222222222222222222222222");
|
||||||
|
// System.out.println(stringBuffer.toString());
|
||||||
// Map<String, Object> mm = new HashMap<>();
|
// stringBuffer.setLength(0);
|
||||||
|
// System.out.println(stringBuffer.toString());
|
||||||
// mm = objectMapper.readValue(json, HashMap.class);
|
// stringBuffer.append("3333333333");
|
||||||
|
// System.out.println(stringBuffer.toString());
|
||||||
// System.out.println(mm.get("interval"));
|
// }
|
||||||
|
|
||||||
// }
|
// // @Test
|
||||||
|
// // public void readAllByTarget() throws Exception {
|
||||||
// @Test
|
// // Target target = new Target();
|
||||||
// public void stringbbb() {
|
// // target.setId(1);
|
||||||
// StringBuffer stringBuffer = new StringBuffer();
|
// // List<Sensor> sensors = this.sensorService.readAllByTarget(target);
|
||||||
|
// //
|
||||||
// stringBuffer.append("222222222222222222222222222");
|
// // ObjectMapper objectMapper = new ObjectMapper();
|
||||||
// System.out.println(stringBuffer.toString());
|
// //
|
||||||
// stringBuffer.setLength(0);
|
// // String json = objectMapper.writeValueAsString(sensors);
|
||||||
// System.out.println(stringBuffer.toString());
|
// //
|
||||||
// stringBuffer.append("3333333333");
|
// // System.out.println(json);
|
||||||
// System.out.println(stringBuffer.toString());
|
// // }
|
||||||
// }
|
|
||||||
|
// // @Test
|
||||||
// // @Test
|
// // public void readAllByTargetList() {
|
||||||
// // public void readAllByTarget() throws Exception {
|
// //
|
||||||
// // Target target = new Target();
|
// // Domain domain = new Domain();
|
||||||
// // target.setId(1);
|
// // domain.setId(1);
|
||||||
// // List<Sensor> sensors = this.sensorService.readAllByTarget(target);
|
// //
|
||||||
// //
|
// // List<Sensor> sl = this.sensorService.readAllByDomain(domain);
|
||||||
// // ObjectMapper objectMapper = new ObjectMapper();
|
// //
|
||||||
// //
|
// // Assert.assertNotEquals(sl.size(), 0);
|
||||||
// // String json = objectMapper.writeValueAsString(sensors);
|
// //
|
||||||
// //
|
// // }
|
||||||
// // System.out.println(json);
|
|
||||||
// // }
|
// // @Test
|
||||||
|
// // public void readAllByInfra() {
|
||||||
// // @Test
|
// //
|
||||||
// // public void readAllByTargetList() {
|
// // Infra infra = new InfraMachine();
|
||||||
// //
|
// // infra.setId(1);
|
||||||
// // Domain domain = new Domain();
|
// //
|
||||||
// // domain.setId(1);
|
// // List<Sensor> sl = this.sensorService.readAllByInfra(1);
|
||||||
// //
|
// //
|
||||||
// // List<Sensor> sl = this.sensorService.readAllByDomain(domain);
|
// // Assert.assertNotEquals(sl.size(), 0);
|
||||||
// //
|
// //
|
||||||
// // Assert.assertNotEquals(sl.size(), 0);
|
// // }
|
||||||
// //
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// // @Test
|
|
||||||
// // public void readAllByInfra() {
|
|
||||||
// //
|
|
||||||
// // Infra infra = new InfraMachine();
|
|
||||||
// // infra.setId(1);
|
|
||||||
// //
|
|
||||||
// // List<Sensor> sl = this.sensorService.readAllByInfra(1);
|
|
||||||
// //
|
|
||||||
// // Assert.assertNotEquals(sl.size(), 0);
|
|
||||||
// //
|
|
||||||
// // }
|
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -1,45 +1,36 @@
|
||||||
package com.loafle.overflow.central.spring;
|
package com.loafle.overflow.central.spring;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.DeserializationConfig;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.springframework.context.annotation.*;
|
import org.springframework.context.annotation.*;
|
||||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||||
import org.springframework.test.context.TestPropertySource;
|
import org.springframework.test.context.TestPropertySource;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geek on 17. 8. 8.
|
* Created by geek on 17. 8. 8.
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan(basePackages = {"com.loafle.overflow"}, excludeFilters = @ComponentScan.Filter({Configuration.class}))
|
@ComponentScan(basePackages = {
|
||||||
@Import({
|
"com.loafle.overflow" }, excludeFilters = @ComponentScan.Filter({ Configuration.class }))
|
||||||
JdbcConfiguration.class,
|
@Import({ JdbcConfiguration.class, MailConfiguration.class, RedisConfiguration.class, CacheConfiguration.class })
|
||||||
MailConfiguration.class,
|
@TestPropertySource({ "classpath:database.properties", "classpath:mail.properties", "classpath:redis.properties",
|
||||||
RedisConfiguration.class,
|
"classpath:cache.properties" })
|
||||||
CacheConfiguration.class
|
|
||||||
})
|
|
||||||
@TestPropertySource({
|
|
||||||
"classpath:database.properties",
|
|
||||||
"classpath:mail.properties",
|
|
||||||
"classpath:redis.properties",
|
|
||||||
"classpath:cache.properties"
|
|
||||||
})
|
|
||||||
|
|
||||||
public class AppConfigTest {
|
public class AppConfigTest {
|
||||||
|
|
||||||
// @Bean
|
// @Bean
|
||||||
// public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
|
// public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
|
||||||
// PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
|
// PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
|
||||||
//// ppc.setLocation(new ClassPathResource("database.properties"));
|
//// ppc.setLocation(new ClassPathResource("database.properties"));
|
||||||
// ppc.setLocations(new Resource[] {
|
// ppc.setLocations(new Resource[] {
|
||||||
// new ClassPathResource("database.properties"),
|
// new ClassPathResource("database.properties"),
|
||||||
// new ClassPathResource("mail.properties"),
|
// new ClassPathResource("mail.properties"),
|
||||||
// new ClassPathResource("redis.properties")
|
// new ClassPathResource("redis.properties")
|
||||||
// });
|
// });
|
||||||
// ppc.setIgnoreUnresolvablePlaceholders(true);
|
// ppc.setIgnoreUnresolvablePlaceholders(true);
|
||||||
//
|
//
|
||||||
// return ppc;
|
// return ppc;
|
||||||
// }
|
// }
|
||||||
@Bean
|
@Bean
|
||||||
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
|
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
|
||||||
return new PropertySourcesPlaceholderConfigurer();
|
return new PropertySourcesPlaceholderConfigurer();
|
||||||
|
@ -47,9 +38,8 @@ public class AppConfigTest {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ObjectMapper getObjectMapper() {
|
public ObjectMapper getObjectMapper() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
return objectMapper;
|
return objectMapper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user