This commit is contained in:
crusader 2018-06-05 22:30:18 +09:00
parent b4eed25b5f
commit 53d88c758c
12 changed files with 27 additions and 44 deletions

View File

@ -49,7 +49,7 @@
<dependency> <dependency>
<groupId>com.loafle.overflow</groupId> <groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId> <artifactId>commons-java</artifactId>
<version>1.0.8-SNAPSHOT</version> <version>1.0.9-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -1,4 +1,4 @@
datasource.url=jdbc:postgresql://192.168.1.103:5432/overflow datasource.url=jdbc:postgresql://192.168.1.101:5432/overflow
datasource.username=overflow datasource.username=overflow
datasource.password=qwer5795 datasource.password=qwer5795
datasource.driver-class-name=org.postgresql.Driver datasource.driver-class-name=org.postgresql.Driver

View File

@ -36,7 +36,7 @@ public class AuthCrawlerServiceTest {
MetaCrawler metaCrawler = new MetaCrawler(); MetaCrawler metaCrawler = new MetaCrawler();
metaCrawler.setId((short)11); metaCrawler.setId((short)11);
authCrawler.setCrawler(metaCrawler); authCrawler.setMetaCrawler(metaCrawler);
authCrawler.setAuthJson("{\"DB Name\":\"test\",\"ID\":\"docker\",\"PassWord\":\"qwer5795QWER\"}"); authCrawler.setAuthJson("{\"DB Name\":\"test\",\"ID\":\"docker\",\"PassWord\":\"qwer5795QWER\"}");
@ -49,15 +49,7 @@ public class AuthCrawlerServiceTest {
@Test @Test
public void findAuth() throws OverflowException { public void findAuth() throws OverflowException {
AuthCrawler authCrawler = this.authCrawlerService.readByMetaCrawlerIDAndTargetID((short)23, Long.valueOf(5));
MetaCrawler metaCrawler = new MetaCrawler();
metaCrawler.setId((short)23);
Target target = new Target();
target.setId(Long.valueOf(5));
AuthCrawler authCrawler = this.authCrawlerService.readAuth(metaCrawler, target);
Assert.assertNotEquals(authCrawler, null); Assert.assertNotEquals(authCrawler, null);

View File

@ -1,6 +1,7 @@
package com.loafle.overflow.central.module.history.service; package com.loafle.overflow.central.module.history.service;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.core.model.PageParams; import com.loafle.overflow.core.model.PageParams;
import com.loafle.overflow.model.domain.Domain; import com.loafle.overflow.model.domain.Domain;
import com.loafle.overflow.model.history.History; import com.loafle.overflow.model.history.History;
@ -31,14 +32,14 @@ public class HistoryServiceTest {
@Test @Test
@Ignore @Ignore
public void registHistories() { public void registHistories() throws OverflowException {
Random rand = new Random(); Random rand = new Random();
for (int i=0;i<100;i++) { for (int i=0;i<100;i++) {
History h = new History(); History h = new History();
h.setMember(new Member(Long.valueOf(1))); h.setMember(new Member(Long.valueOf(1)));
h.setProbe(new Probe(rand.nextBoolean() ? Long.valueOf(1) : Long.valueOf(2))); h.setProbe(new Probe(rand.nextBoolean() ? Long.valueOf(1) : Long.valueOf(2)));
h.setDomain(new Domain(Long.valueOf(1))); h.setDomain(new Domain(Long.valueOf(1)));
h.setType(new MetaHistoryType(rand.nextInt((6 - 1) + 1) + 1)); h.setMetaHistoryType(new MetaHistoryType(rand.nextInt((6 - 1) + 1) + 1));
h.setMessage("Test History " + i); h.setMessage("Test History " + i);
this.historyService.regist(h); this.historyService.regist(h);
} }
@ -53,7 +54,7 @@ public class HistoryServiceTest {
// } // }
@Test @Test
public void readAllByProbe() { public void readAllByProbe() throws OverflowException {
PageParams p = new PageParams(); PageParams p = new PageParams();
p.setPageNo(0); p.setPageNo(0);
p.setCountPerPage(10); p.setCountPerPage(10);

View File

@ -33,7 +33,7 @@ public class InfraDAOTest {
probes.add(probe); probes.add(probe);
this.infraDAO.findAllTargetByProbeList(probes); this.infraDAO.findAllTargetByProbeIn(probes);
} }

View File

@ -29,7 +29,7 @@ public class InfraHostServiceTest {
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
@Test @Test
// @Ignore // @Ignore
public void regist() throws Exception { public void regist() throws Exception {
InfraHost infraHost = new InfraHost(); InfraHost infraHost = new InfraHost();
@ -39,15 +39,13 @@ public class InfraHostServiceTest {
InfraOS infraOS = new InfraOS(); InfraOS infraOS = new InfraOS();
infraOS.setId(Long.valueOf(2)); infraOS.setId(Long.valueOf(2));
infraHost.setOs(infraOS); infraHost.setInfraOS(infraOS);
MetaInfraType metaInfraType = new MetaInfraType();
metaInfraType.setId(2);
MetaInfraType metaInfraType = new MetaInfraType(2);
this.infraHostService.regist(infraHost); this.infraHostService.regist(infraHost);
Assert.assertNotEquals(infraHost.getId().longValue(), 0 ); Assert.assertNotEquals(infraHost.getId().longValue(), 0);
} }
@ -67,7 +65,7 @@ public class InfraHostServiceTest {
InfraHost infraHost; InfraHost infraHost;
try { try {
infraHost = this.infraHostService.readByIp("192.168.1.1"); infraHost = this.infraHostService.readByProbeIdAndIpv4(Long.valueOf(1), "192.168.1.1");
Assert.assertNotEquals(infraHost, null); Assert.assertNotEquals(infraHost, null);
} catch (OverflowException e) { } catch (OverflowException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block

View File

@ -36,9 +36,7 @@ public class InfraMachineServiceTest {
infraMachine.setMeta("i am a infra machine"); infraMachine.setMeta("i am a infra machine");
MetaInfraType metaInfraType = new MetaInfraType(); MetaInfraType metaInfraType = new MetaInfraType(1);
metaInfraType.setId(1);
this.infraMachineService.regist(infraMachine); this.infraMachineService.regist(infraMachine);

View File

@ -38,10 +38,9 @@ public class InfraOSApplicationServiceTest {
InfraOS infraOS = new InfraOS(); InfraOS infraOS = new InfraOS();
infraOS.setId(Long.valueOf(2)); infraOS.setId(Long.valueOf(2));
infraOSApplication.setOs(infraOS); infraOSApplication.setInfraOS(infraOS);
MetaInfraType metaInfraType = new MetaInfraType(); MetaInfraType metaInfraType = new MetaInfraType(4);
metaInfraType.setId(4);
this.infraOSApplicationService.regist(infraOSApplication); this.infraOSApplicationService.regist(infraOSApplication);

View File

@ -38,11 +38,9 @@ public class InfraOSDaemonServiceTest {
InfraOS infraOS = new InfraOS(); InfraOS infraOS = new InfraOS();
infraOS.setId(Long.valueOf(2)); infraOS.setId(Long.valueOf(2));
infraOSDaemon.setOs(infraOS); infraOSDaemon.setInfraOS(infraOS);
MetaInfraType metaInfraType = new MetaInfraType();
metaInfraType.setId(5);
MetaInfraType metaInfraType = new MetaInfraType(5);
this.infraOSDaemonService.regist(infraOSDaemon); this.infraOSDaemonService.regist(infraOSDaemon);

View File

@ -39,11 +39,9 @@ public class InfraOSPortServiceTest {
InfraOS infraOS = new InfraOS(); InfraOS infraOS = new InfraOS();
infraOS.setId(Long.valueOf(1)); infraOS.setId(Long.valueOf(1));
MetaInfraType metaInfraType = new MetaInfraType(); MetaInfraType metaInfraType = new MetaInfraType(2);
metaInfraType.setId(2);
infraOSPort.setInfraOS(infraOS);
infraOSPort.setOs(infraOS);
// FIXME::vendor??? // FIXME::vendor???
@ -58,7 +56,7 @@ public class InfraOSPortServiceTest {
InfraOSPort infraOSPort; InfraOSPort infraOSPort;
try { try {
infraOSPort = this.infraOSPortService.readByPort(Long.valueOf(1), 22, "TCP"); infraOSPort = this.infraOSPortService.readByInfraOSIDAndPortAndPortType(Long.valueOf(1), 22, "TCP");
Assert.assertNotEquals(infraOSPort, null); Assert.assertNotEquals(infraOSPort, null);
} catch (OverflowException e) { } catch (OverflowException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block

View File

@ -36,16 +36,15 @@ public class InfraOSServiceTest {
MetaInfraVendor metaInfraVendor = new MetaInfraVendor(); MetaInfraVendor metaInfraVendor = new MetaInfraVendor();
metaInfraVendor.setId(26); metaInfraVendor.setId(26);
infraOS.setVendor(metaInfraVendor); infraOS.setMetaInfraVendor(metaInfraVendor);
infraOS.setMeta(""); infraOS.setMeta("");
InfraMachine infraMachine = new InfraMachine(); InfraMachine infraMachine = new InfraMachine();
infraMachine.setId(Long.valueOf(1)); infraMachine.setId(Long.valueOf(1));
MetaInfraType metaInfraType = new MetaInfraType(); MetaInfraType metaInfraType = new MetaInfraType(3);
metaInfraType.setId(3);
infraOS.setMachine(infraMachine); infraOS.setInfraMachine(infraMachine);

View File

@ -50,7 +50,7 @@ public class NoAuthProbeServiceTest {
MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus(); MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();
metaNoAuthProbeStatus.setId((short) 3); metaNoAuthProbeStatus.setId((short) 3);
noAuthProbe.setStatus(metaNoAuthProbeStatus); noAuthProbe.setMetaNoAuthProbeStatus(metaNoAuthProbeStatus);
noAuthProbe.setTempProbeKey("ac7f252b5bc811e784ad080027658d13"); noAuthProbe.setTempProbeKey("ac7f252b5bc811e784ad080027658d13");
Domain d = new Domain(); Domain d = new Domain();
@ -79,7 +79,7 @@ public class NoAuthProbeServiceTest {
MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus(); MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();
metaNoAuthProbeStatus.setId((short) 3); metaNoAuthProbeStatus.setId((short) 3);
noAuthProbe.setStatus(metaNoAuthProbeStatus); noAuthProbe.setMetaNoAuthProbeStatus(metaNoAuthProbeStatus);
noAuthProbe.setTempProbeKey("a1c7f252b5bc811e784ad080027658d13"); noAuthProbe.setTempProbeKey("a1c7f252b5bc811e784ad080027658d13");
Domain d = new Domain(); Domain d = new Domain();