added service
probe , probe task
This commit is contained in:
parent
c5bc4f79ce
commit
4e610cef6a
|
@ -19,7 +19,6 @@ public class NoAuthProbeService {
|
|||
|
||||
|
||||
public void regist(NoAuthProbe noAuthProbe) {
|
||||
|
||||
this.noAuthProbeDAO.save(noAuthProbe);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package com.loafle.overflow.module.probe.service;
|
||||
|
||||
import com.loafle.overflow.module.domain.model.Domain;
|
||||
import com.loafle.overflow.module.probe.dao.ProbeDAO;
|
||||
import com.loafle.overflow.module.probe.model.Probe;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 28.
|
||||
*/
|
||||
@Service
|
||||
public class ProbeService {
|
||||
|
||||
@Autowired
|
||||
private ProbeDAO probeDAO;
|
||||
|
||||
public void regist(Probe probe) {
|
||||
this.probeDAO.save(probe);
|
||||
}
|
||||
|
||||
public List<Probe> readAllByDomain(Domain domain) {
|
||||
|
||||
return this.probeDAO.findAllByDomain(domain);
|
||||
}
|
||||
|
||||
public Probe readByProbeKey(String probeKey) {
|
||||
|
||||
return this.probeDAO.findByProbeKey(probeKey);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.loafle.overflow.module.probe.service;
|
||||
|
||||
import com.loafle.overflow.module.probe.dao.ProbeTaskDAO;
|
||||
import com.loafle.overflow.module.probe.model.Probe;
|
||||
import com.loafle.overflow.module.probe.model.ProbeTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 28.
|
||||
*/
|
||||
@Service
|
||||
public class ProbeTaskService {
|
||||
|
||||
@Autowired
|
||||
private ProbeTaskDAO probeTaskDAO;
|
||||
|
||||
public void regist(ProbeTask probeTask) {
|
||||
this.probeTaskDAO.save(probeTask);
|
||||
}
|
||||
|
||||
public List<ProbeTask> readAllByProbe(Probe probe) {
|
||||
return this.probeTaskDAO.findAllByProbe(probe);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.loafle.overflow.module.probe.service;
|
||||
|
||||
import com.loafle.overflow.module.domain.model.Domain;
|
||||
import com.loafle.overflow.module.meta.model.MetaProbeStatus;
|
||||
import com.loafle.overflow.module.probe.model.Probe;
|
||||
import com.loafle.overflow.spring.AppConfig;
|
||||
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||
import org.junit.Assert;
|
||||
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 static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 28.
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||
public class ProbeServiceTest {
|
||||
|
||||
@Autowired
|
||||
private ProbeService probeService;
|
||||
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
|
||||
Probe probe = new Probe();
|
||||
|
||||
|
||||
probe.setDescription("snoop probe");
|
||||
|
||||
Domain domain = new Domain();
|
||||
domain.setId(1);
|
||||
|
||||
probe.setDomain(domain);
|
||||
|
||||
probe.setEncryptionKey("8c51fa9c5bcc11e7980a080027658d13");
|
||||
probe.setProbeKey("899fdd145bcc11e7b611080027658d13");
|
||||
|
||||
MetaProbeStatus status = new MetaProbeStatus();
|
||||
status.setId((short)1);
|
||||
|
||||
probe.setStatus(status);
|
||||
|
||||
this.probeService.regist(probe);
|
||||
|
||||
Assert.assertNotEquals(probe.getId(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readAllByDomain() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readByProbeKey() throws Exception {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.loafle.overflow.module.probe.service;
|
||||
|
||||
import com.loafle.overflow.module.meta.model.MetaProbeTaskType;
|
||||
import com.loafle.overflow.module.probe.model.Probe;
|
||||
import com.loafle.overflow.module.probe.model.ProbeTask;
|
||||
import com.loafle.overflow.spring.AppConfig;
|
||||
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||
import org.junit.Assert;
|
||||
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.util.List;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 28.
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||
public class ProbeTaskServiceTest {
|
||||
|
||||
@Autowired
|
||||
private ProbeTaskService probeTaskService;
|
||||
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
|
||||
ProbeTask probeTask = new ProbeTask();
|
||||
|
||||
MetaProbeTaskType typeDiscovery = new MetaProbeTaskType();
|
||||
typeDiscovery.setId((short)1);
|
||||
|
||||
probeTask.setMetaProbeTaskType(typeDiscovery);
|
||||
probeTask.setData("");
|
||||
|
||||
Probe probe = new Probe();
|
||||
probe.setId(1);
|
||||
|
||||
probeTask.setProbe(probe);
|
||||
|
||||
this.probeTaskService.regist(probeTask);
|
||||
|
||||
Assert.assertNotEquals(probeTask.getId(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readAllByProbe() throws Exception {
|
||||
|
||||
regist();
|
||||
|
||||
Probe probe = new Probe();
|
||||
probe.setId(1);
|
||||
|
||||
List<ProbeTask> probeTasks = this.probeTaskService.readAllByProbe(probe);
|
||||
|
||||
Assert.assertNotEquals(probeTasks.size(), 0 );
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user