This commit is contained in:
insanity 2018-06-28 17:43:18 +09:00
parent 6e4405750e
commit c29ea212b5
2 changed files with 41 additions and 42 deletions

View File

@ -50,7 +50,7 @@
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId>
<version>1.0.106-SNAPSHOT</version>
<version>1.0.109-SNAPSHOT</version>
</dependency>
<dependency>

View File

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