remove InfraHost in Probe
This commit is contained in:
parent
a422808cf2
commit
51aa8e3c6e
|
@ -28,7 +28,7 @@ public class Probe {
|
|||
private String cidr;
|
||||
private Date authorizeDate;
|
||||
private Member authorizeMember;
|
||||
private InfraHost host;
|
||||
// private InfraHost host;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
|
@ -155,14 +155,14 @@ public class Probe {
|
|||
public void setAuthorizeMember(Member authorizeMember) {
|
||||
this.authorizeMember = authorizeMember;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "HOST_ID", nullable = false)
|
||||
public InfraHost getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(InfraHost host) {
|
||||
this.host = host;
|
||||
}
|
||||
//
|
||||
// @ManyToOne
|
||||
// @JoinColumn(name = "HOST_ID", nullable = false)
|
||||
// public InfraHost getHost() {
|
||||
// return host;
|
||||
// }
|
||||
//
|
||||
// public void setHost(InfraHost host) {
|
||||
// this.host = host;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -397,3 +397,39 @@ INSERT INTO public.domain_member (create_date,domain_id,member_id) VALUES (
|
|||
INSERT INTO public.api_key (api_key,create_date,domain_id) VALUES (
|
||||
'52abd6fd57e511e7ac52080027658d13','2017-06-26 13:02:28.347',1);
|
||||
|
||||
|
||||
|
||||
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
|
||||
'INFRA_MACHINE','2017-08-21 12:59:10.244',1,NULL,NULL);
|
||||
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
|
||||
'INFRA_OS','2017-08-21 13:05:24.883',3,NULL,NULL);
|
||||
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
|
||||
'INFRA_HOST','2017-08-21 14:20:01.830',2,NULL,NULL);
|
||||
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
|
||||
'INFRA_SERVICE','2017-08-21 14:24:26.525',7,NULL,NULL);
|
||||
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
|
||||
'INFRA_OS_APPLICATION','2017-08-21 14:27:19.474',4,NULL,NULL);
|
||||
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
|
||||
'INFRA_OS_DAEMON','2017-08-21 14:28:48.761',5,NULL,NULL);
|
||||
|
||||
|
||||
INSERT INTO public.infra_machine (meta,id) VALUES (
|
||||
'i am a infra machine',1);
|
||||
|
||||
INSERT INTO public.infra_os (meta,id,machine_id,vendor_id) VALUES (
|
||||
'',2,1,26);
|
||||
|
||||
INSERT INTO public.infra_host (ip,mac,id,os_id) VALUES (
|
||||
3232235980,8796753988883,3,2);
|
||||
|
||||
INSERT INTO public.infra_service (port,port_type,tls_type,id,host_id,vendor_id) VALUES (
|
||||
80,'TCP',false,4,3,45);
|
||||
|
||||
INSERT INTO public.infra_os_application ("name",id,os_id) VALUES (
|
||||
'Apache',5,2);
|
||||
|
||||
INSERT INTO public.infra_os_daemon ("name",id,os_id) VALUES (
|
||||
'Apache',6,2);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.loafle.overflow.module.infra.service;
|
|||
import com.loafle.overflow.module.infra.model.InfraHost;
|
||||
|
||||
import com.loafle.overflow.module.infra.model.InfraOS;
|
||||
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
||||
import com.loafle.overflow.module.meta.model.MetaInfraVendor;
|
||||
import com.loafle.overflow.spring.AppConfigTest;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.junit.Assert;
|
||||
|
@ -25,7 +27,7 @@ public class InfraHostServiceTest {
|
|||
private InfraHostService infraHostService;
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
// @Ignore
|
||||
public void regist() throws Exception {
|
||||
|
||||
InfraHost infraHost = new InfraHost();
|
||||
|
@ -34,9 +36,16 @@ public class InfraHostServiceTest {
|
|||
infraHost.setIp(3232235980L);
|
||||
|
||||
InfraOS infraOS = new InfraOS();
|
||||
infraOS.setId(1);
|
||||
infraOS.setId(2);
|
||||
|
||||
infraHost.setOs(infraOS);
|
||||
|
||||
MetaInfraType metaInfraType = new MetaInfraType();
|
||||
metaInfraType.setId(2);
|
||||
|
||||
infraHost.setInfraType(metaInfraType);
|
||||
|
||||
|
||||
// infraHost.setOs(infraOS);
|
||||
|
||||
this.infraHostService.regist(infraHost);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.loafle.overflow.module.infra.service;
|
|||
|
||||
import com.loafle.overflow.module.infra.model.InfraOS;
|
||||
import com.loafle.overflow.module.infra.model.InfraOSApplication;
|
||||
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
||||
import com.loafle.overflow.spring.AppConfigTest;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.junit.Assert;
|
||||
|
@ -24,7 +25,7 @@ public class InfraOSApplicationServiceTest {
|
|||
@Autowired
|
||||
private InfraOSApplicationService infraOSApplicationService;
|
||||
|
||||
@Ignore
|
||||
// @Ignore
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
InfraOSApplication infraOSApplication = new InfraOSApplication();
|
||||
|
@ -32,10 +33,14 @@ public class InfraOSApplicationServiceTest {
|
|||
infraOSApplication.setName("Apache");
|
||||
|
||||
InfraOS infraOS = new InfraOS();
|
||||
infraOS.setId(1);
|
||||
infraOS.setId(2);
|
||||
|
||||
infraOSApplication.setOs(infraOS);
|
||||
|
||||
MetaInfraType metaInfraType = new MetaInfraType();
|
||||
metaInfraType.setId(4);
|
||||
infraOSApplication.setInfraType(metaInfraType);
|
||||
|
||||
this.infraOSApplicationService.regist(infraOSApplication);
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.loafle.overflow.module.infra.service;
|
|||
|
||||
import com.loafle.overflow.module.infra.model.InfraOS;
|
||||
import com.loafle.overflow.module.infra.model.InfraOSDaemon;
|
||||
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
||||
import com.loafle.overflow.spring.AppConfigTest;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.junit.Assert;
|
||||
|
@ -24,7 +25,7 @@ public class InfraOSDaemonServiceTest {
|
|||
@Autowired
|
||||
private InfraOSDaemonService infraOSDaemonService;
|
||||
|
||||
@Ignore
|
||||
// @Ignore
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
|
||||
|
@ -32,10 +33,15 @@ public class InfraOSDaemonServiceTest {
|
|||
infraOSDaemon.setName("Apache");
|
||||
|
||||
InfraOS infraOS = new InfraOS();
|
||||
infraOS.setId(1);
|
||||
infraOS.setId(2);
|
||||
|
||||
infraOSDaemon.setOs(infraOS);
|
||||
|
||||
MetaInfraType metaInfraType = new MetaInfraType();
|
||||
metaInfraType.setId(5);
|
||||
|
||||
infraOSDaemon.setInfraType(metaInfraType);
|
||||
|
||||
this.infraOSDaemonService.regist(infraOSDaemon);
|
||||
|
||||
Assert.assertNotEquals(infraOSDaemon.getId(), 0);
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.loafle.overflow.module.infra.service;
|
|||
|
||||
import com.loafle.overflow.module.infra.model.InfraOS;
|
||||
import com.loafle.overflow.module.infra.model.InfraOSPort;
|
||||
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
||||
import com.loafle.overflow.spring.AppConfigTest;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
@ -22,7 +23,7 @@ public class InfraOSPortServiceTest {
|
|||
@Autowired
|
||||
private InfraOSPortService infraOSPortService;
|
||||
|
||||
@Ignore
|
||||
// @Ignore
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
|
||||
|
@ -33,6 +34,11 @@ public class InfraOSPortServiceTest {
|
|||
InfraOS infraOS = new InfraOS();
|
||||
infraOS.setId(1);
|
||||
|
||||
MetaInfraType metaInfraType = new MetaInfraType();
|
||||
metaInfraType.setId(2);
|
||||
|
||||
infraOSPort.setInfraType(metaInfraType);
|
||||
|
||||
infraOSPort.setOs(infraOS);
|
||||
|
||||
// FIXME::vendor???
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.loafle.overflow.module.infra.service;
|
|||
|
||||
import com.loafle.overflow.module.infra.model.InfraHost;
|
||||
import com.loafle.overflow.module.infra.model.InfraService;
|
||||
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
||||
import com.loafle.overflow.module.meta.model.MetaInfraVendor;
|
||||
import com.loafle.overflow.spring.AppConfigTest;
|
||||
import org.junit.Assert;
|
||||
|
@ -25,7 +26,7 @@ public class InfraServiceServiceTest {
|
|||
@Autowired
|
||||
private InfraServiceService infraServiceService;
|
||||
|
||||
@Ignore
|
||||
// @Ignore
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
|
||||
|
@ -35,7 +36,7 @@ public class InfraServiceServiceTest {
|
|||
infraService.setPortType("TCP");
|
||||
|
||||
InfraHost infraHost = new InfraHost();
|
||||
infraHost.setId(1);
|
||||
infraHost.setId(3);
|
||||
|
||||
infraService.setHost(infraHost);
|
||||
infraService.setTlsType(false);
|
||||
|
@ -45,6 +46,11 @@ public class InfraServiceServiceTest {
|
|||
|
||||
infraService.setVendor(metaInfraVendor);
|
||||
|
||||
MetaInfraType metaInfraType = new MetaInfraType();
|
||||
metaInfraType.setId(7);
|
||||
|
||||
infraService.setInfraType(metaInfraType);
|
||||
|
||||
this.infraServiceService.regist(infraService);
|
||||
|
||||
Assert.assertNotEquals(infraService.getId(), 0);
|
||||
|
|
Loading…
Reference in New Issue
Block a user