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>
<groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
</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.password=qwer5795
datasource.driver-class-name=org.postgresql.Driver

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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