This commit is contained in:
crusader 2018-06-15 17:42:13 +09:00
parent 9c5ee4fb4b
commit 727b32b78b
12 changed files with 202 additions and 199 deletions

View File

@ -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,7 +72,8 @@ 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 =
// this.authCrawlerService.readByMetaCrawlerIDAndTargetID(dbSensor.getMetaCrawler().getId(),
// dbSensor.getTarget().getId()); // dbSensor.getTarget().getId());
// if (authCrawler == null) { // if (authCrawler == null) {
@ -81,11 +84,13 @@ public class InfraHostGenerator {
// 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 =
// this.objectMapper.readValue(authCrawler.getAuthJson(),
// new TypeReference<Map<String, String>>() { // new TypeReference<Map<String, String>>() {
// }); // });
// if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.WMI_CRAWLER.getValue()) { // if (dbSensor.getMetaCrawler().getId() ==
// MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
// connection.setPort(135); // connection.setPort(135);
// connection.setPortType(PortType.TCP); // connection.setPortType(PortType.TCP);
// connection.setSsl(false); // connection.setSsl(false);

View File

@ -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;

View File

@ -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,7 +79,8 @@ 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 =
// this.authCrawlerService.readByMetaCrawlerIDAndTargetID(sensor.getMetaCrawler().getId(),
// sensor.getTarget().getId()); // sensor.getTarget().getId());
// if (authCrawler == null) { // if (authCrawler == null) {
@ -91,17 +96,21 @@ public class InfraServiceGenerator {
// target.setConnection(connection); // target.setConnection(connection);
// HashMap<String, String> optionMap = this.objectMapper.readValue(authCrawler.getAuthJson(), // HashMap<String, String> optionMap =
// this.objectMapper.readValue(authCrawler.getAuthJson(),
// new TypeReference<Map<String, String>>() { // 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("url", "jdbc:mysql://" + infraService.getInfraHost().getIpv4() +
// ":" + infraService.getPort());
// // 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() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) { // // } 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
// // connection.setPort(9840); // // connection.setPort(9840);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
} }

View File

@ -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;

View File

@ -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;
@ -32,7 +32,6 @@
// @Autowired // @Autowired
// ObjectMapper objectMapper; // ObjectMapper objectMapper;
// @Ignore // @Ignore
// @Test // @Test
// public void regist() throws Exception { // public void regist() throws Exception {

View File

@ -1,29 +1,20 @@
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 {
@ -48,8 +39,7 @@ 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;
} }
} }