TargetService regist test code
This commit is contained in:
parent
7ceea83e6c
commit
1aa3b1ffbd
|
@ -0,0 +1,78 @@
|
|||
package com.loafle.overflow.central.module.target.service;
|
||||
|
||||
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.meta.*;
|
||||
import com.loafle.overflow.model.sensor.Sensor;
|
||||
import com.loafle.overflow.model.target.Target;
|
||||
import com.loafle.overflow.service.central.infra.InfraService;
|
||||
import com.loafle.overflow.service.central.meta.MetaCrawlerService;
|
||||
import com.loafle.overflow.service.central.meta.MetaSensorStatusService;
|
||||
import com.loafle.overflow.service.central.target.TargetService;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ActiveProfiles("test")
|
||||
@ContextConfiguration(classes = {AppConfigTest.class})
|
||||
public class CentralTargetServiceTest {
|
||||
|
||||
@Autowired
|
||||
TargetService targetService;
|
||||
|
||||
@Autowired
|
||||
InfraService infraService;
|
||||
|
||||
@Autowired
|
||||
MetaCrawlerService metaCrawlerService;
|
||||
|
||||
@Autowired
|
||||
MetaSensorStatusService metaSensorStatusService;
|
||||
|
||||
@Test
|
||||
public void regist() {
|
||||
}
|
||||
|
||||
// List<Target> targets, Long probeID
|
||||
@Test
|
||||
public void registAll() throws OverflowException {
|
||||
List<Target> targets = new ArrayList<>();
|
||||
List<Sensor> sensors = new ArrayList<>();
|
||||
|
||||
|
||||
List<MetaCrawler> metaCrawlers = this.metaCrawlerService.readAll();
|
||||
List<MetaSensorStatus> metaSensorStatusList = this.metaSensorStatusService.readAll();
|
||||
// MetaSensorDisplayItem metaSensorDisplayItem = this.metaSensorDisplayItemService.read(Long.valueOf(1));
|
||||
|
||||
Target target = new Target();
|
||||
target.setMetaTargetType(MetaTargetServiceType.Enum.UNKNOWN.to());
|
||||
target.setInfra(new com.loafle.overflow.model.infra.InfraService(Long.valueOf((long)3)));
|
||||
|
||||
Sensor sensor = new Sensor();
|
||||
sensor.setItemCount(0);
|
||||
sensor.setCrawlerInputItems(null);
|
||||
sensor.setMetaCrawler(metaCrawlers.get(5));
|
||||
sensor.setName("Test Sensor");
|
||||
sensor.setTarget(target);
|
||||
sensor.setMetaSensorStatus(metaSensorStatusList.get(0));
|
||||
|
||||
sensors.add(sensor);
|
||||
|
||||
target.setSensors(sensors);
|
||||
|
||||
targets.add(target);
|
||||
List<Target> targetList = this.targetService.registAll(targets, Long.valueOf(1));
|
||||
|
||||
System.out.println("Target List Size: " + targetList.size());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user