From 7621db70353231c8fd327fa27d3c2ce844cb84b0 Mon Sep 17 00:00:00 2001 From: snoop Date: Wed, 30 Aug 2017 19:50:08 +0900 Subject: [PATCH] added auth crawler --- .../module/auth/service/AuthCrawlerService.java | 15 +++++++++++++++ .../module/sensor/service/SensorService.java | 2 +- .../sensor/service/SensorServiceTest.java | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/loafle/overflow/module/auth/service/AuthCrawlerService.java b/src/main/java/com/loafle/overflow/module/auth/service/AuthCrawlerService.java index 6e0f780..2bd1488 100644 --- a/src/main/java/com/loafle/overflow/module/auth/service/AuthCrawlerService.java +++ b/src/main/java/com/loafle/overflow/module/auth/service/AuthCrawlerService.java @@ -2,6 +2,9 @@ package com.loafle.overflow.module.auth.service; import com.loafle.overflow.module.auth.dao.AuthCrawlerDAO; import com.loafle.overflow.module.auth.model.AuthCrawler; +import com.loafle.overflow.module.infra.model.Infra; +import com.loafle.overflow.module.infra.service.InfraService; +import com.loafle.overflow.module.meta.model.MetaCrawler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -14,7 +17,19 @@ public class AuthCrawlerService { @Autowired private AuthCrawlerDAO authCrawlerDAO; + @Autowired + private InfraService infraService; + public AuthCrawler regist(AuthCrawler authCrawler) { return this.authCrawlerDAO.save(authCrawler); } + + public boolean checkAuthCrawler(long infraId, MetaCrawler crawler, String authJson) { + + Infra infra = this.infraService.read(infraId); + + // FIXME: Check Crawler + + return false; + } } diff --git a/src/main/java/com/loafle/overflow/module/sensor/service/SensorService.java b/src/main/java/com/loafle/overflow/module/sensor/service/SensorService.java index 9bfa05d..0803d17 100644 --- a/src/main/java/com/loafle/overflow/module/sensor/service/SensorService.java +++ b/src/main/java/com/loafle/overflow/module/sensor/service/SensorService.java @@ -98,7 +98,7 @@ public class SensorService { } @Transactional - public Sensor registSensorConfig(Sensor sensor, List sensorItemList) { + public Sensor registSensorConfig(Sensor sensor, List sensorItemList, String etcJson) { this.sensorDAO.save(sensor); diff --git a/src/test/java/com/loafle/overflow/module/sensor/service/SensorServiceTest.java b/src/test/java/com/loafle/overflow/module/sensor/service/SensorServiceTest.java index 4368424..d0f8fbf 100644 --- a/src/test/java/com/loafle/overflow/module/sensor/service/SensorServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/sensor/service/SensorServiceTest.java @@ -16,6 +16,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.io.IOException; import java.util.Date; +import java.util.HashMap; +import java.util.Map; /** * Created by insanity on 17. 6. 28. @@ -70,6 +72,21 @@ public class SensorServiceTest { } + @Test + public void testJsonToMap() throws IOException { + + String json = "{\"interval\":5}"; + + ObjectMapper objectMapper = new ObjectMapper(); + + Map mm = new HashMap<>(); + + mm = objectMapper.readValue(json, HashMap.class); + + System.out.println(mm.get("interval")); + + } + // @Test // public void readAllByTarget() throws Exception { // Target target = new Target();