From c29ea212b5c1f4954ce1a39d2233af6dfa9e1ac3 Mon Sep 17 00:00:00 2001 From: insanity Date: Thu, 28 Jun 2018 17:43:18 +0900 Subject: [PATCH] 109 --- pom.xml | 2 +- .../sensor/service/SensorServiceTest.java | 81 +++++++++---------- 2 files changed, 41 insertions(+), 42 deletions(-) diff --git a/pom.xml b/pom.xml index 588ba00..93ab629 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ com.loafle.overflow commons-java - 1.0.106-SNAPSHOT + 1.0.109-SNAPSHOT diff --git a/src/test/java/com/loafle/overflow/central/module/sensor/service/SensorServiceTest.java b/src/test/java/com/loafle/overflow/central/module/sensor/service/SensorServiceTest.java index bda62dc..b9c161b 100644 --- a/src/test/java/com/loafle/overflow/central/module/sensor/service/SensorServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/sensor/service/SensorServiceTest.java @@ -1,49 +1,48 @@ - package com.loafle.overflow.central.module.sensor.service; +package com.loafle.overflow.central.module.sensor.service; - import com.loafle.overflow.central.spring.AppConfigTest; - import com.fasterxml.jackson.databind.ObjectMapper; - import com.loafle.overflow.service.central.sensor.SensorService; - import org.junit.Assert; - import org.junit.Ignore; - import org.junit.Test; - import org.junit.runner.RunWith; - import org.springframework.beans.factory.annotation.Autowired; - import org.springframework.test.context.ContextConfiguration; - import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import com.loafle.overflow.central.module.meta.dao.MetaDisplayItemMappingDAO; +import com.loafle.overflow.central.spring.AppConfigTest; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.loafle.overflow.model.sensor.Sensor; +import com.loafle.overflow.model.target.Target; +import com.loafle.overflow.service.central.sensor.SensorService; +import com.loafle.overflow.service.central.target.TargetService; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +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. */ - //@Ignore - @RunWith(SpringJUnit4ClassRunner.class) - @ContextConfiguration(classes = {AppConfigTest.class}) - public class SensorServiceTest { - @Autowired - SensorService sensorService; +// @Ignore +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { AppConfigTest.class }) +public class SensorServiceTest { + @Autowired + SensorService sensorService; - @Autowired - ObjectMapper objectMapper; + @Autowired + TargetService targetService; + @Autowired + MetaDisplayItemMappingDAO metaDisplayItemMappingService; - @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()); + @Autowired + ObjectMapper objectMapper; - Sensor res = this.sensorService.regist(sensor); - Assert.assertNotNull(res); - } - } + @Test + @Ignore + public void regist() throws Exception { + + Target target = this.targetService.read(Long.valueOf(1)); + Sensor sensor = new Sensor(); + sensor.setTarget(target); + + Sensor result = this.sensorService.regist(sensor, this.metaDisplayItemMappingService.findAll()); + Assert.assertNotNull(result); + } +}