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> <dependency>
<groupId>com.loafle.overflow</groupId> <groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId> <artifactId>commons-java</artifactId>
<version>1.0.106-SNAPSHOT</version> <version>1.0.109-SNAPSHOT</version>
</dependency> </dependency>
<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.loafle.overflow.central.module.meta.dao.MetaDisplayItemMappingDAO;
import com.fasterxml.jackson.databind.ObjectMapper; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.service.central.sensor.SensorService; import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Assert; import com.loafle.overflow.model.sensor.Sensor;
import org.junit.Ignore; import com.loafle.overflow.model.target.Target;
import org.junit.Test; import com.loafle.overflow.service.central.sensor.SensorService;
import org.junit.runner.RunWith; import com.loafle.overflow.service.central.target.TargetService;
import org.springframework.beans.factory.annotation.Autowired; import org.junit.Assert;
import org.springframework.test.context.ContextConfiguration; import org.junit.Ignore;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 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. * Created by insanity on 17. 6. 28.
*/ */
//@Ignore // @Ignore
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) @ContextConfiguration(classes = { AppConfigTest.class })
public class SensorServiceTest { public class SensorServiceTest {
@Autowired @Autowired
SensorService sensorService; SensorService sensorService;
@Autowired
TargetService targetService;
@Autowired
MetaDisplayItemMappingDAO metaDisplayItemMappingService;
@Autowired @Autowired
ObjectMapper objectMapper; ObjectMapper objectMapper;
@Test @Test
@Ignore
public void regist() throws Exception { 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());
Sensor res = this.sensorService.regist(sensor); Target target = this.targetService.read(Long.valueOf(1));
Assert.assertNotNull(res); Sensor sensor = new Sensor();
} sensor.setTarget(target);
Sensor result = this.sensorService.regist(sensor, this.metaDisplayItemMappingService.findAll());
Assert.assertNotNull(result);
} }
}