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.Target;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -61,8 +61,10 @@ public class InfraHostGenerator {
Map<Integer, MetaSensorItemKey> keyMap = this.generateUtil.initMappingMap(dbSensor.getMetaCrawler());
// if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
// this.infraHostWMIGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
// if (dbSensor.getMetaCrawler().getId() ==
// MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
// this.infraHostWMIGenerator.process(sensorItems, keyMap, dbSensor,
// sensorConfig);
// }
return objectMapper.writeValueAsString(sensorConfig);
@ -70,7 +72,8 @@ public class InfraHostGenerator {
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());
// if (authCrawler == null) {
@ -81,11 +84,13 @@ public class InfraHostGenerator {
// Connection connection = new Connection();
// // 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>>() {
// });
// if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
// if (dbSensor.getMetaCrawler().getId() ==
// MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
// connection.setPort(135);
// connection.setPortType(PortType.TCP);
// 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.SensorConfig;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
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.service.central.auth.AuthCrawlerService;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -64,10 +64,14 @@ public class InfraServiceGenerator {
Map<Integer, MetaSensorItemKey> keyMap = this.generateUtil.initMappingMap(dbSensor.getMetaCrawler());
// if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
// this.infraServiceMysqlGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
// } else if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
// this.infraServiceJMXGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
// if (dbSensor.getMetaCrawler().getId() ==
// MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
// this.infraServiceMysqlGenerator.process(sensorItems, keyMap, dbSensor,
// sensorConfig);
// } else if (dbSensor.getMetaCrawler().getId() ==
// MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
// this.infraServiceJMXGenerator.process(sensorItems, keyMap, dbSensor,
// sensorConfig);
// }
return objectMapper.writeValueAsString(sensorConfig);
@ -75,7 +79,8 @@ public class InfraServiceGenerator {
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());
// if (authCrawler == null) {
@ -91,17 +96,21 @@ public class InfraServiceGenerator {
// 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>>() {
// });
// Map<String, Object> auth = new HashMap<>();
// // if (sensor.getMetaCrawler().getId() == MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
// // auth.put("url", "jdbc:mysql://" + infraService.getInfraHost().getIpv4() + ":" + infraService.getPort());
// // if (sensor.getMetaCrawler().getId() ==
// 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("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("pw", optionMap.get("PassWord")); // FIXME: Auth Info
// // 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.SensorConfig;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
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.SensorConfig;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
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.ProbeService;
import org.codehaus.jackson.map.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

View File

@ -4,8 +4,8 @@ import com.google.gson.internal.Primitives;
import com.google.protobuf.ByteString;
import com.loafle.overflow.core.exception.OverflowException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.JavaType;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
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.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.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;

View File

@ -1,7 +1,7 @@
package com.loafle.overflow.central.spring;
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.*;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@ -44,7 +44,7 @@ public class AppConfig {
@Bean
public ObjectMapper getObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper;
}

View File

@ -7,7 +7,7 @@ import java.util.List;
import com.loafle.overflow.central.spring.AppConfigTest;
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.runner.RunWith;
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.target.model.Target;
// 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.Ignore;
// import org.junit.Test;
@ -32,7 +32,6 @@
// @Autowired
// ObjectMapper objectMapper;
// @Ignore
// @Test
// public void regist() throws Exception {

View File

@ -1,45 +1,36 @@
package com.loafle.overflow.central.spring;
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.*;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.test.context.TestPropertySource;
/**
* Created by geek on 17. 8. 8.
*/
@Configuration
@ComponentScan(basePackages = {"com.loafle.overflow"}, excludeFilters = @ComponentScan.Filter({Configuration.class}))
@Import({
JdbcConfiguration.class,
MailConfiguration.class,
RedisConfiguration.class,
CacheConfiguration.class
})
@TestPropertySource({
"classpath:database.properties",
"classpath:mail.properties",
"classpath:redis.properties",
"classpath:cache.properties"
})
@ComponentScan(basePackages = {
"com.loafle.overflow" }, excludeFilters = @ComponentScan.Filter({ Configuration.class }))
@Import({ JdbcConfiguration.class, MailConfiguration.class, RedisConfiguration.class, CacheConfiguration.class })
@TestPropertySource({ "classpath:database.properties", "classpath:mail.properties", "classpath:redis.properties",
"classpath:cache.properties" })
public class AppConfigTest {
// @Bean
// public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
// PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
//// ppc.setLocation(new ClassPathResource("database.properties"));
// ppc.setLocations(new Resource[] {
// new ClassPathResource("database.properties"),
// new ClassPathResource("mail.properties"),
// new ClassPathResource("redis.properties")
// });
// ppc.setIgnoreUnresolvablePlaceholders(true);
//
// return ppc;
// }
// @Bean
// public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
// PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
//// ppc.setLocation(new ClassPathResource("database.properties"));
// ppc.setLocations(new Resource[] {
// new ClassPathResource("database.properties"),
// new ClassPathResource("mail.properties"),
// new ClassPathResource("redis.properties")
// });
// ppc.setIgnoreUnresolvablePlaceholders(true);
//
// return ppc;
// }
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
@ -48,8 +39,7 @@ public class AppConfigTest {
@Bean
public ObjectMapper getObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper;
}
}