fixed infra
model
This commit is contained in:
parent
9f85062ce7
commit
feaa908023
|
@ -2,6 +2,8 @@ package com.loafle.overflow.module.infra.model;
|
||||||
|
|
||||||
|
|
||||||
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
||||||
|
import com.loafle.overflow.module.probe.model.Probe;
|
||||||
|
import com.loafle.overflow.module.target.model.Target;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -16,6 +18,8 @@ public class Infra {
|
||||||
private MetaInfraType type;
|
private MetaInfraType type;
|
||||||
private long childId;
|
private long childId;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
|
private Probe probe;
|
||||||
|
private Target target;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
private long id;
|
private long id;
|
||||||
|
@ -66,6 +70,25 @@ public class Infra {
|
||||||
this.createDate = createDate;
|
this.createDate = createDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "PROBE_ID", nullable = false)
|
||||||
|
public Probe getProbe() {
|
||||||
|
return probe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProbe(Probe probe) {
|
||||||
|
this.probe = probe;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "TARGET_ID", nullable = false)
|
||||||
|
public Target getTarget() {
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTarget(Target target) {
|
||||||
|
this.target = target;
|
||||||
|
}
|
||||||
|
|
||||||
public static Infra CreateInfraByType(long id, Class c) {
|
public static Infra CreateInfraByType(long id, Class c) {
|
||||||
|
|
||||||
|
|
|
@ -409,19 +409,19 @@ INSERT INTO public.infra_os (id,create_date,meta,machine_id,vendor_id) VALUES (
|
||||||
INSERT INTO public.infra_host (id,create_date,ip,mac,os_id) VALUES (
|
INSERT INTO public.infra_host (id,create_date,ip,mac,os_id) VALUES (
|
||||||
1,'2017-07-27 19:57:10.607',3232235980,8796753988883,1);
|
1,'2017-07-27 19:57:10.607',3232235980,8796753988883,1);
|
||||||
|
|
||||||
INSERT INTO public.infra (id,child_id,create_date,type_id) VALUES (
|
|
||||||
1,1,'2017-07-27 20:10:41.458',1);
|
|
||||||
INSERT INTO public.infra (id,child_id,create_date,type_id) VALUES (
|
|
||||||
2,1,'2017-07-27 20:10:41.479',3);
|
|
||||||
INSERT INTO public.infra (id,child_id,create_date,type_id) VALUES (
|
|
||||||
3,1,'2017-07-27 20:10:41.506',2);
|
|
||||||
|
|
||||||
INSERT INTO public.probe (id,authorize_date,cidr,create_date,description,display_name,encryption_key,probe_key,sensor_count,target_count,authorize_member_id,domain_id,host_id,status) VALUES (
|
INSERT INTO public.probe (id,authorize_date,cidr,create_date,description,display_name,encryption_key,probe_key,sensor_count,target_count,authorize_member_id,domain_id,host_id,status) VALUES (
|
||||||
1,'2017-07-27 20:01:28.513','192.168.1.0/24','2017-07-27 20:01:28.513','snoop probe','test probe','8c51fa9c5bcc11e7980a080027658d13','899fdd145bcc11e7b611080027658d13',0,0,1,1,1,1);
|
1,'2017-07-27 20:01:28.513','192.168.1.0/24','2017-07-27 20:01:28.513','snoop probe','test probe','8c51fa9c5bcc11e7980a080027658d13','899fdd145bcc11e7b611080027658d13',0,0,1,1,1,1);
|
||||||
|
|
||||||
INSERT INTO public.target (id,create_date,description,display_name) VALUES (
|
INSERT INTO public.target (id,create_date,description,display_name) VALUES (
|
||||||
1,'2017-07-27 20:18:09.555','i am target','ghost target');
|
1,'2017-07-27 20:18:09.555','i am target','ghost target');
|
||||||
|
|
||||||
|
INSERT INTO public.infra (id,child_id,create_date,probe_id,target_id,type_id) VALUES (
|
||||||
|
1,1,'2017-07-28 11:08:50.803',1,1,1);
|
||||||
|
INSERT INTO public.infra (id,child_id,create_date,probe_id,target_id,type_id) VALUES (
|
||||||
|
2,1,'2017-07-28 11:08:50.832',1,1,3);
|
||||||
|
INSERT INTO public.infra (id,child_id,create_date,probe_id,target_id,type_id) VALUES (
|
||||||
|
3,1,'2017-07-28 11:08:50.841',1,1,2);
|
||||||
|
|
||||||
INSERT INTO public.sensor (id,crawler_input_items,create_date,description,crawler_id,status,target_id) VALUES (
|
INSERT INTO public.sensor (id,crawler_input_items,create_date,description,crawler_id,status,target_id) VALUES (
|
||||||
1,NULL,'2017-06-26 20:19:07.009','My sensor',1,1,1);
|
1,NULL,'2017-06-26 20:19:07.009','My sensor',1,1,1);
|
||||||
INSERT INTO public.sensor (id,crawler_input_items,create_date,description,crawler_id,status,target_id) VALUES (
|
INSERT INTO public.sensor (id,crawler_input_items,create_date,description,crawler_id,status,target_id) VALUES (
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.loafle.overflow.module.infra.service;
|
||||||
import com.loafle.overflow.module.infra.model.Infra;
|
import com.loafle.overflow.module.infra.model.Infra;
|
||||||
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
||||||
import com.loafle.overflow.module.meta.model.MetaInfraVendor;
|
import com.loafle.overflow.module.meta.model.MetaInfraVendor;
|
||||||
|
import com.loafle.overflow.module.probe.model.Probe;
|
||||||
|
import com.loafle.overflow.module.target.model.Target;
|
||||||
import com.loafle.overflow.spring.AppConfig;
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
import com.loafle.overflow.spring.JdbcConfiguration;
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
import com.loafle.overflow.spring.MailConfiguration;
|
import com.loafle.overflow.spring.MailConfiguration;
|
||||||
|
@ -49,7 +51,19 @@ public class InfraServiceTest {
|
||||||
infra.setType(metaInfraType);
|
infra.setType(metaInfraType);
|
||||||
infra.setChildId(childId);
|
infra.setChildId(childId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Probe probe = new Probe();
|
||||||
|
probe.setId(1);
|
||||||
|
|
||||||
|
Target target = new Target();
|
||||||
|
target.setId(1);
|
||||||
|
|
||||||
|
infra.setProbe(probe);
|
||||||
|
infra.setTarget(target);
|
||||||
|
|
||||||
this.infraService.regist(infra);
|
this.infraService.regist(infra);
|
||||||
|
|
||||||
return infra.getId();
|
return infra.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user