fixed infra series model
This commit is contained in:
parent
4d00504612
commit
be24ebf19f
|
@ -21,8 +21,8 @@ public interface InfraDAO extends JpaRepository<Infra, Long> {
|
||||||
List<Infra> findAllByProbe(List<Probe> probeList);
|
List<Infra> findAllByProbe(List<Probe> probeList);
|
||||||
|
|
||||||
|
|
||||||
@Query("SELECT DISTINCT i.target FROM Infra i WHERE i.probe IN (:probeList)")
|
// @Query("SELECT DISTINCT i.target FROM Infra i WHERE i.probe IN (:probeList)")
|
||||||
List<Target> findAllTargetByProbeList(@Param("probeList") List<Probe> probeList);
|
// List<Target> findAllTargetByProbeList(@Param("probeList") List<Probe> probeList);
|
||||||
|
|
||||||
// List<Infra> findAllByProbe(List<Probe> probeList);
|
// List<Infra> findAllByProbe(List<Probe> probeList);
|
||||||
}
|
}
|
|
@ -11,16 +11,24 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 22.
|
* Created by root on 17. 6. 22.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity(name = "INFRA")
|
||||||
@Table(name = "INFRA", schema = "public", catalog = "postgres")
|
//@Table(name = "INFRA", schema = "public", catalog = "postgres")
|
||||||
public class Infra {
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
|
@DiscriminatorColumn(name = "INFRA_TYPE")
|
||||||
|
public abstract class Infra {
|
||||||
private long id;
|
private long id;
|
||||||
private MetaInfraType infraType;
|
private MetaInfraType infraType;
|
||||||
private long childId;
|
// private long childId;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
private Probe probe;
|
private Probe probe;
|
||||||
private Target target;
|
private Target target;
|
||||||
|
|
||||||
|
// private InfraChild infraChild;
|
||||||
|
|
||||||
|
// private InfraHost infraHost;
|
||||||
|
// private InfraMachine infraMachine;
|
||||||
|
// private InfraOS infraOS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
private long id;
|
private long id;
|
||||||
private MetaInfraType infraType;
|
private MetaInfraType infraType;
|
||||||
|
@ -29,6 +37,55 @@ public class Infra {
|
||||||
private Probe probeId;
|
private Probe probeId;
|
||||||
private Target targetId;
|
private Target targetId;
|
||||||
*/
|
*/
|
||||||
|
// @ManyToOne
|
||||||
|
// @JoinColumn(name = "CHILD_ID", nullable = false, insertable = false, updatable = false)
|
||||||
|
// public InfraHost getInfraChild() {
|
||||||
|
// return infraChild;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setInfraChild(InfraChild infraChild) {
|
||||||
|
// this.infraChild = infraChild;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @OneToOne
|
||||||
|
// @JoinColumn(name = "CHILD_ID")
|
||||||
|
// public InfraChild getInfraChild() {
|
||||||
|
// return infraChild;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setInfraChild(InfraChild infraChild) {
|
||||||
|
// this.infraChild = infraChild;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @ManyToOne
|
||||||
|
// @JoinColumn(name = "HOST_ID")
|
||||||
|
// public InfraHost getInfraHost() {
|
||||||
|
// return infraHost;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setInfraHost(InfraHost infraHost) {
|
||||||
|
// this.infraHost = infraHost;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @ManyToOne
|
||||||
|
// @JoinColumn(name = "MACHINE_ID")
|
||||||
|
// public InfraMachine getInfraMachine() {
|
||||||
|
// return infraMachine;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setInfraMachine(InfraMachine infraMachine) {
|
||||||
|
// this.infraMachine = infraMachine;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @ManyToOne
|
||||||
|
// @JoinColumn(name = "OS_ID")
|
||||||
|
// public InfraOS getInfraOS() {
|
||||||
|
// return infraOS;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setInfraOS(InfraOS infraOS) {
|
||||||
|
// this.infraOS = infraOS;
|
||||||
|
// }
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||||
|
@ -50,15 +107,15 @@ public class Infra {
|
||||||
this.infraType = infraType;
|
this.infraType = infraType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic
|
// @Basic
|
||||||
@Column(name = "CHILD_ID", nullable = false)
|
// @Column(name = "CHILD_ID", nullable = false)
|
||||||
public long getChildId() {
|
// public long getChildId() {
|
||||||
return childId;
|
// return childId;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setChildId(long childId) {
|
// public void setChildId(long childId) {
|
||||||
this.childId = childId;
|
// this.childId = childId;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||||
|
@ -71,7 +128,7 @@ public class Infra {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "PROBE_ID", nullable = false)
|
@JoinColumn(name = "PROBE_ID", nullable = true)
|
||||||
public Probe getProbe() {
|
public Probe getProbe() {
|
||||||
return probe;
|
return probe;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +138,7 @@ public class Infra {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "TARGET_ID", nullable = false)
|
@JoinColumn(name = "TARGET_ID", nullable = true)
|
||||||
public Target getTarget() {
|
public Target getTarget() {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
@ -90,37 +147,37 @@ public class Infra {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Infra CreateInfraByType(long id, Class c) {
|
// public static Infra CreateInfraByType(long id, Class c) {
|
||||||
|
//
|
||||||
Infra infra = new Infra();
|
// Infra infra = new Infra();
|
||||||
infra.setChildId(id);
|
//// infra.setChildId(id);
|
||||||
|
//
|
||||||
MetaInfraType infraType = new MetaInfraType();
|
// MetaInfraType infraType = new MetaInfraType();
|
||||||
if(c == InfraMachine.class) {
|
// if(c == InfraMachine.class) {
|
||||||
infraType.setId(1);
|
// infraType.setId(1);
|
||||||
}
|
// }
|
||||||
else if(c == InfraHost.class) {
|
// else if(c == InfraHost.class) {
|
||||||
infraType.setId(2);
|
// infraType.setId(2);
|
||||||
}
|
// }
|
||||||
else if(c == InfraOS.class) {
|
// else if(c == InfraOS.class) {
|
||||||
infraType.setId(3);
|
// infraType.setId(3);
|
||||||
}
|
// }
|
||||||
else if(c == InfraOSApplication.class) {
|
// else if(c == InfraOSApplication.class) {
|
||||||
infraType.setId(4);
|
// infraType.setId(4);
|
||||||
}
|
// }
|
||||||
else if(c == InfraOSDaemon.class) {
|
// else if(c == InfraOSDaemon.class) {
|
||||||
infraType.setId(5);
|
// infraType.setId(5);
|
||||||
}
|
// }
|
||||||
else if(c == InfraOSPort.class) {
|
// else if(c == InfraOSPort.class) {
|
||||||
infraType.setId(6);
|
// infraType.setId(6);
|
||||||
}
|
// }
|
||||||
else if(c == InfraService.class) {
|
// else if(c == InfraService.class) {
|
||||||
infraType.setId(7);
|
// infraType.setId(7);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
infra.setInfraType(infraType);
|
// infra.setInfraType(infraType);
|
||||||
|
//
|
||||||
return infra;
|
// return infra;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,27 +6,28 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 22.
|
* Created by root on 17. 6. 22.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity(name = "INFRA_HOST")
|
||||||
@Table(name = "INFRA_HOST", schema = "public", catalog = "postgres")
|
//@Table(name = "INFRA_HOST", schema = "public", catalog = "postgres")
|
||||||
public class InfraHost {
|
@DiscriminatorValue("INFRA_HOST")
|
||||||
private long id;
|
public class InfraHost extends Infra {
|
||||||
|
// private long id;
|
||||||
private InfraOS os;
|
private InfraOS os;
|
||||||
private long ip;
|
private long ip;
|
||||||
private long mac;
|
private long mac;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
|
|
||||||
@Id
|
// @Id
|
||||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
// @GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||||
public long getId() {
|
// public long getId() {
|
||||||
return id;
|
// return id;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setId(long id) {
|
// public void setId(long id) {
|
||||||
this.id = id;
|
// this.id = id;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "OS_ID", nullable = false)
|
@JoinColumn(name = "OS_ID", nullable = true)
|
||||||
public InfraOS getOs() {
|
public InfraOS getOs() {
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +37,7 @@ public class InfraHost {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "IP", nullable = false)
|
@Column(name = "IP", nullable = true)
|
||||||
public long getIp() {
|
public long getIp() {
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +47,7 @@ public class InfraHost {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "MAC", nullable = false)
|
@Column(name = "MAC", nullable = true)
|
||||||
public long getMac() {
|
public long getMac() {
|
||||||
return mac;
|
return mac;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +57,7 @@ public class InfraHost {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
@Column(name = "CREATE_DATE", nullable = true, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||||
public Date getCreateDate() {
|
public Date getCreateDate() {
|
||||||
return createDate;
|
return createDate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,11 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 22.
|
* Created by root on 17. 6. 22.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity(name = "INFRA_MACHINE")
|
||||||
@Table(name = "INFRA_MACHINE", schema = "public", catalog = "postgres")
|
//@Table(name = "INFRA_MACHINE", schema = "public", catalog = "postgres")
|
||||||
public class InfraMachine {
|
@DiscriminatorValue("INFRA_MACHINE")
|
||||||
private long id;
|
public class InfraMachine extends Infra {
|
||||||
|
// private long id;
|
||||||
|
|
||||||
private String meta;
|
private String meta;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
|
@ -22,15 +23,15 @@ public class InfraMachine {
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Id
|
// @Id
|
||||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
// @GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||||
public long getId() {
|
// public long getId() {
|
||||||
return id;
|
// return id;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setId(long id) {
|
// public void setId(long id) {
|
||||||
this.id = id;
|
// this.id = id;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "META", nullable = true, length = 255)
|
@Column(name = "META", nullable = true, length = 255)
|
||||||
|
|
|
@ -9,27 +9,28 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 22.
|
* Created by root on 17. 6. 22.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity(name = "INFRA_OS")
|
||||||
@Table(name = "INFRA_OS", schema = "public", catalog = "postgres")
|
//@Table(name = "INFRA_OS", schema = "public", catalog = "postgres")
|
||||||
public class InfraOS {
|
@DiscriminatorValue("INFRA_OS")
|
||||||
private long id;
|
public class InfraOS extends Infra {
|
||||||
|
// private long id;
|
||||||
private InfraMachine machine;
|
private InfraMachine machine;
|
||||||
private String meta;
|
private String meta;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
private MetaInfraVendor vendor;
|
private MetaInfraVendor vendor;
|
||||||
|
|
||||||
@Id
|
// @Id
|
||||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
// @GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||||
public long getId() {
|
// public long getId() {
|
||||||
return id;
|
// return id;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setId(long id) {
|
// public void setId(long id) {
|
||||||
this.id = id;
|
// this.id = id;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "MACHINE_ID", nullable = false)
|
@JoinColumn(name = "MACHINE_ID", nullable = true)
|
||||||
public InfraMachine getMachine() {
|
public InfraMachine getMachine() {
|
||||||
return machine;
|
return machine;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +50,7 @@ public class InfraOS {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
@Column(name = "CREATE_DATE", nullable = true, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||||
public Date getCreateDate() {
|
public Date getCreateDate() {
|
||||||
return createDate;
|
return createDate;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +60,7 @@ public class InfraOS {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "VENDOR_ID", nullable = false)
|
@JoinColumn(name = "VENDOR_ID", nullable = true)
|
||||||
public MetaInfraVendor getVendor() {
|
public MetaInfraVendor getVendor() {
|
||||||
return vendor;
|
return vendor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,26 +6,27 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 22.
|
* Created by root on 17. 6. 22.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity(name = "INFRA_OS_APPLICATION")
|
||||||
@Table(name = "INFRA_OS_APPLICATION", schema = "public", catalog = "postgres")
|
//@Table(name = "INFRA_OS_APPLICATION", schema = "public", catalog = "postgres")
|
||||||
public class InfraOSApplication {
|
@DiscriminatorValue("INFRA_OS_APPLICATION")
|
||||||
private long id;
|
public class InfraOSApplication extends Infra {
|
||||||
|
// private long id;
|
||||||
private InfraOS os;
|
private InfraOS os;
|
||||||
private String name;
|
private String name;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
|
|
||||||
@Id
|
// @Id
|
||||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
// @GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||||
public long getId() {
|
// public long getId() {
|
||||||
return id;
|
// return id;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setId(long id) {
|
// public void setId(long id) {
|
||||||
this.id = id;
|
// this.id = id;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "OS_ID", nullable = false)
|
@JoinColumn(name = "OS_ID", nullable = true)
|
||||||
public InfraOS getOs() {
|
public InfraOS getOs() {
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +46,7 @@ public class InfraOSApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
@Column(name = "CREATE_DATE", nullable = true, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||||
public Date getCreateDate() {
|
public Date getCreateDate() {
|
||||||
return createDate;
|
return createDate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,26 +6,27 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 22.
|
* Created by root on 17. 6. 22.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity(name = "INFRA_OS_DAEMON")
|
||||||
@Table(name = "INFRA_OS_DAEMON", schema = "public", catalog = "postgres")
|
//@Table(name = "INFRA_OS_DAEMON", schema = "public", catalog = "postgres")
|
||||||
public class InfraOSDaemon {
|
@DiscriminatorValue("INFRA_OS_DAEMON")
|
||||||
private long id;
|
public class InfraOSDaemon extends Infra {
|
||||||
|
// private long id;
|
||||||
private InfraOS os;
|
private InfraOS os;
|
||||||
private String name;
|
private String name;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
|
|
||||||
@Id
|
// @Id
|
||||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
// @GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||||
public long getId() {
|
// public long getId() {
|
||||||
return id;
|
// return id;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setId(long id) {
|
// public void setId(long id) {
|
||||||
this.id = id;
|
// this.id = id;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "OS_ID", nullable = false)
|
@JoinColumn(name = "OS_ID", nullable = true)
|
||||||
public InfraOS getOs() {
|
public InfraOS getOs() {
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +46,7 @@ public class InfraOSDaemon {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
@Column(name = "CREATE_DATE", nullable = true, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||||
public Date getCreateDate() {
|
public Date getCreateDate() {
|
||||||
return createDate;
|
return createDate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,29 +9,30 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 22.
|
* Created by root on 17. 6. 22.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity(name = "INFRA_OS_PORT")
|
||||||
@Table(name = "INFRA_OS_PORT", schema = "public", catalog = "postgres")
|
//@Table(name = "INFRA_OS_PORT", schema = "public", catalog = "postgres")
|
||||||
public class InfraOSPort {
|
@DiscriminatorValue("INFRA_OS_PORT")
|
||||||
private long id;
|
public class InfraOSPort extends Infra {
|
||||||
|
// private long id;
|
||||||
private InfraOS os;
|
private InfraOS os;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
private Integer port;
|
private Integer port;
|
||||||
private String portType;
|
private String portType;
|
||||||
private MetaInfraVendor vendor;
|
private MetaInfraVendor vendor;
|
||||||
private boolean tlsType;
|
private boolean tlsType;
|
||||||
|
//
|
||||||
@Id
|
// @Id
|
||||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
// @GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||||
public long getId() {
|
// public long getId() {
|
||||||
return id;
|
// return id;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setId(long id) {
|
// public void setId(long id) {
|
||||||
this.id = id;
|
// this.id = id;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "OS_ID", nullable = false)
|
@JoinColumn(name = "OS_ID", nullable = true)
|
||||||
public InfraOS getOs() {
|
public InfraOS getOs() {
|
||||||
return this.os;
|
return this.os;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +42,7 @@ public class InfraOSPort {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
@Column(name = "CREATE_DATE", nullable = true, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||||
public Date getCreateDate() {
|
public Date getCreateDate() {
|
||||||
return createDate;
|
return createDate;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +62,7 @@ public class InfraOSPort {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "PORT_TYPE", nullable = false)
|
@Column(name = "PORT_TYPE", nullable = true)
|
||||||
public String getPortType() {
|
public String getPortType() {
|
||||||
return portType;
|
return portType;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +82,7 @@ public class InfraOSPort {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "TLS_TYPE", nullable = false)
|
@Column(name = "TLS_TYPE", nullable = true)
|
||||||
public boolean isTlsType() {
|
public boolean isTlsType() {
|
||||||
return tlsType;
|
return tlsType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,11 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 22.
|
* Created by root on 17. 6. 22.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity(name = "INFRA_SERVICE")
|
||||||
@Table(name = "INFRA_SERVICE", schema = "public", catalog = "postgres")
|
//@Table(name = "INFRA_SERVICE", schema = "public", catalog = "postgres")
|
||||||
public class InfraService {
|
@DiscriminatorValue("INFRA_SERVICE")
|
||||||
private long id;
|
public class InfraService extends Infra{
|
||||||
|
// private long id;
|
||||||
private InfraHost host;
|
private InfraHost host;
|
||||||
private String portType;
|
private String portType;
|
||||||
private Integer port;
|
private Integer port;
|
||||||
|
@ -20,18 +21,18 @@ public class InfraService {
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
private boolean tlsType;
|
private boolean tlsType;
|
||||||
|
|
||||||
@Id
|
// @Id
|
||||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
// @GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||||
public long getId() {
|
// public long getId() {
|
||||||
return id;
|
// return id;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setId(long id) {
|
// public void setId(long id) {
|
||||||
this.id = id;
|
// this.id = id;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "HOST_ID", nullable = false)
|
@JoinColumn(name = "HOST_ID", nullable = true)
|
||||||
public InfraHost getHost() {
|
public InfraHost getHost() {
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +42,7 @@ public class InfraService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "PORT_TYPE", nullable = false)
|
@Column(name = "PORT_TYPE", nullable = true)
|
||||||
public String getPortType() {
|
public String getPortType() {
|
||||||
return portType;
|
return portType;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +62,7 @@ public class InfraService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "VENDOR_ID", nullable = false)
|
@JoinColumn(name = "VENDOR_ID", nullable = true)
|
||||||
public MetaInfraVendor getVendor() {
|
public MetaInfraVendor getVendor() {
|
||||||
return vendor;
|
return vendor;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +72,7 @@ public class InfraService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
@Column(name = "CREATE_DATE", nullable = true, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||||
public Date getCreateDate() {
|
public Date getCreateDate() {
|
||||||
return createDate;
|
return createDate;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +82,7 @@ public class InfraService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "TLS_TYPE", nullable = false)
|
@Column(name = "TLS_TYPE", nullable = true)
|
||||||
public boolean isTlsType() {
|
public boolean isTlsType() {
|
||||||
return tlsType;
|
return tlsType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class InfraService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Target> readAllTargetByProbeList(List<Probe> probeList) {
|
public List<Target> readAllTargetByProbeList(List<Probe> probeList) {
|
||||||
return this.infraDAO.findAllTargetByProbeList(probeList);
|
// return this.infraDAO.findAllTargetByProbeList(probeList);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,101 +42,101 @@ public class TargetDiscoveryService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private InfraServiceDAO infraServiceDAO;
|
private InfraServiceDAO infraServiceDAO;
|
||||||
|
|
||||||
@Transactional
|
// @Transactional
|
||||||
public void saveAllTarget(List<Host> hosts, Probe probe) {
|
// public void saveAllTarget(List<Host> hosts, Probe probe) {
|
||||||
|
//
|
||||||
for(Host host : hosts) {
|
// for(Host host : hosts) {
|
||||||
|
//
|
||||||
InfraMachine infraMachine = new InfraMachine();
|
// InfraMachine infraMachine = new InfraMachine();
|
||||||
// infraMachine.setProbe(probe);
|
//// infraMachine.setProbe(probe);
|
||||||
this.infraMachineDAO.save(infraMachine);
|
// this.infraMachineDAO.save(infraMachine);
|
||||||
|
//
|
||||||
Infra infraByMachine = Infra.CreateInfraByType(infraMachine.getId(), InfraMachine.class);
|
// Infra infraByMachine = Infra.CreateInfraByType(infraMachine.getId(), InfraMachine.class);
|
||||||
this.infraDAO.save(infraByMachine);
|
// this.infraDAO.save(infraByMachine);
|
||||||
|
//
|
||||||
|
//
|
||||||
InfraOS infraOS = new InfraOS();
|
// InfraOS infraOS = new InfraOS();
|
||||||
infraOS.setMachine(infraMachine);
|
//// infraOS.setMachine(infraMachine);
|
||||||
infraOS.setVendor(MetaInfraVendor.CreateInfraVendorByOS(host.getOs()));
|
//// infraOS.setVendor(MetaInfraVendor.CreateInfraVendorByOS(host.getOs()));
|
||||||
this.infraOSDAO.save(infraOS);
|
// this.infraOSDAO.save(infraOS);
|
||||||
|
//
|
||||||
Infra infraByOS = Infra.CreateInfraByType(infraOS.getId(), InfraOS.class);
|
// Infra infraByOS = Infra.CreateInfraByType(infraOS.getId(), InfraOS.class);
|
||||||
this.infraDAO.save(infraByOS);
|
// this.infraDAO.save(infraByOS);
|
||||||
|
//
|
||||||
|
//
|
||||||
InfraHost infraHost = new InfraHost();
|
// InfraHost infraHost = new InfraHost();
|
||||||
infraHost.setIp(host.getIp());
|
// infraHost.setIp(host.getIp());
|
||||||
infraHost.setMac(host.getMac());
|
// infraHost.setMac(host.getMac());
|
||||||
infraHost.setOs(infraOS);
|
//// infraHost.setOs(infraOS);
|
||||||
this.infraHostDAO.save(infraHost);
|
// this.infraHostDAO.save(infraHost);
|
||||||
|
//
|
||||||
Infra infraByHost = Infra.CreateInfraByType(infraHost.getId(), InfraHost.class);
|
// Infra infraByHost = Infra.CreateInfraByType(infraHost.getId(), InfraHost.class);
|
||||||
this.infraDAO.save(infraByHost);
|
// this.infraDAO.save(infraByHost);
|
||||||
|
//
|
||||||
if(host.isTarget()) {
|
// if(host.isTarget()) {
|
||||||
Target targetHost = new Target();
|
// Target targetHost = new Target();
|
||||||
// targetHost.setInfra(infraByHost);
|
//// targetHost.setInfra(infraByHost);
|
||||||
// targetHost.setProbe(probe);
|
//// targetHost.setProbe(probe);
|
||||||
this.targetDAO.save(targetHost);
|
// this.targetDAO.save(targetHost);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(host.getPorts() == null) {
|
// if(host.getPorts() == null) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
for(Port port : host.getPorts()) {
|
// for(Port port : host.getPorts()) {
|
||||||
|
//
|
||||||
InfraOSPort infraOSPort = new InfraOSPort();
|
// InfraOSPort infraOSPort = new InfraOSPort();
|
||||||
infraOSPort.setOs(infraOS);
|
// infraOSPort.setOs(infraOS);
|
||||||
infraOSPort.setPort(port.getPortNumber());
|
// infraOSPort.setPort(port.getPortNumber());
|
||||||
infraOSPort.setPortType("UDP");
|
// infraOSPort.setPortType("UDP");
|
||||||
if(port.getPortType() == PortType.TLS || port.getPortType() == PortType.TCP) {
|
// if(port.getPortType() == PortType.TLS || port.getPortType() == PortType.TCP) {
|
||||||
infraOSPort.setPortType("TCP");
|
// infraOSPort.setPortType("TCP");
|
||||||
}
|
// }
|
||||||
if (port.getPortType() == PortType.TLS) {
|
// if (port.getPortType() == PortType.TLS) {
|
||||||
infraOSPort.setTlsType(true);
|
// infraOSPort.setTlsType(true);
|
||||||
}
|
// }
|
||||||
infraOSPort.setVendor(MetaInfraVendor.CreateInfraVendorByPort(port.getPortNumber()));
|
// infraOSPort.setVendor(MetaInfraVendor.CreateInfraVendorByPort(port.getPortNumber()));
|
||||||
this.infraOSPortDAO.save(infraOSPort);
|
// this.infraOSPortDAO.save(infraOSPort);
|
||||||
|
//
|
||||||
Infra infraByPort = Infra.CreateInfraByType(infraOSPort.getId(), InfraOSPort.class);
|
// Infra infraByPort = Infra.CreateInfraByType(infraOSPort.getId(), InfraOSPort.class);
|
||||||
this.infraDAO.save(infraByPort);
|
// this.infraDAO.save(infraByPort);
|
||||||
|
//
|
||||||
if(port.getServices() == null) {
|
// if(port.getServices() == null) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
for(com.loafle.overflow.module.discovery.model.Service service : port.getServices()) {
|
// for(com.loafle.overflow.module.discovery.model.Service service : port.getServices()) {
|
||||||
|
//
|
||||||
InfraService infraService = new InfraService();
|
// InfraService infraService = new InfraService();
|
||||||
infraService.setHost(infraHost);
|
// infraService.setHost(infraHost);
|
||||||
infraService.setPort(port.getPortNumber());
|
// infraService.setPort(port.getPortNumber());
|
||||||
infraService.setPortType("UDP");
|
// infraService.setPortType("UDP");
|
||||||
if(port.getPortType() == PortType.TLS || port.getPortType() == PortType.TCP) {
|
// if(port.getPortType() == PortType.TLS || port.getPortType() == PortType.TCP) {
|
||||||
infraService.setPortType("TCP");
|
// infraService.setPortType("TCP");
|
||||||
}
|
// }
|
||||||
if (port.getPortType() == PortType.TLS) {
|
// if (port.getPortType() == PortType.TLS) {
|
||||||
infraService.setTlsType(true);
|
// infraService.setTlsType(true);
|
||||||
}
|
// }
|
||||||
infraService.setVendor(MetaInfraVendor.CreateInfraVendorByService(service.getServiceName()));
|
// infraService.setVendor(MetaInfraVendor.CreateInfraVendorByService(service.getServiceName()));
|
||||||
this.infraServiceDAO.save(infraService);
|
// this.infraServiceDAO.save(infraService);
|
||||||
|
//
|
||||||
Infra infraByService = Infra.CreateInfraByType(infraService.getId(), InfraService.class);
|
// Infra infraByService = Infra.CreateInfraByType(infraService.getId(), InfraService.class);
|
||||||
this.infraDAO.save(infraByService);
|
// this.infraDAO.save(infraByService);
|
||||||
|
//
|
||||||
if(service.isTarget()) {
|
// if(service.isTarget()) {
|
||||||
Target targetService = new Target();
|
// Target targetService = new Target();
|
||||||
// targetService.setInfra(infraByService);
|
//// targetService.setInfra(infraByService);
|
||||||
// targetService.setProbe(probe);
|
//// targetService.setProbe(probe);
|
||||||
this.targetDAO.save(targetService);
|
// this.targetDAO.save(targetService);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,54 +397,3 @@ INSERT INTO public.domain_member (create_date,domain_id,member_id) VALUES (
|
||||||
INSERT INTO public.api_key (api_key,create_date,domain_id) VALUES (
|
INSERT INTO public.api_key (api_key,create_date,domain_id) VALUES (
|
||||||
'52abd6fd57e511e7ac52080027658d13','2017-06-26 13:02:28.347',1);
|
'52abd6fd57e511e7ac52080027658d13','2017-06-26 13:02:28.347',1);
|
||||||
|
|
||||||
INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES (
|
|
||||||
'52abd6fd57e511e7ac52080027658d13','2017-06-26 12:43:46.877','snoop',3232235980,8796753988883,'1cf2555c57d511e79714080027658d13',1,NULL,3);
|
|
||||||
|
|
||||||
INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES (
|
|
||||||
'52abd6fd57e511e7ac52080027658d14','2017-08-11 12:43:46.877','geek',3232235980,8796753988883,'1cf2555c57d511e79714080027658d14',1,NULL,3);
|
|
||||||
|
|
||||||
INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES (
|
|
||||||
'52abd6fd57e511e7ac52080027658d15','2017-08-11 12:43:46.877','insanity',3232235980,8796753988883,'1cf2555c57d511e79714080027658d15',1,NULL,3);
|
|
||||||
|
|
||||||
INSERT INTO public.infra_machine (create_date,meta) VALUES (
|
|
||||||
'2017-07-27 19:54:26.677','');
|
|
||||||
|
|
||||||
INSERT INTO public.infra_os (create_date,meta,machine_id,vendor_id) VALUES (
|
|
||||||
'2017-07-27 19:55:47.326','',1,26);
|
|
||||||
|
|
||||||
INSERT INTO public.infra_host (create_date,ip,mac,os_id) VALUES (
|
|
||||||
'2017-07-27 19:57:10.607',3232235980,8796753988883,1);
|
|
||||||
|
|
||||||
INSERT INTO public.infra_service (create_date,port,port_type,tls_type,host_id,vendor_id) VALUES (
|
|
||||||
'2017-07-28 16:36:33.906',80,'TCP',false,1,45);
|
|
||||||
|
|
||||||
INSERT INTO public.infra_os_application (create_date,name,os_id) VALUES (
|
|
||||||
'2017-07-28 16:54:11.646','Apache',1);
|
|
||||||
|
|
||||||
INSERT INTO public.infra_os_daemon (create_date,name,os_id) VALUES (
|
|
||||||
'2017-07-28 17:00:35.186','Apache',1);
|
|
||||||
|
|
||||||
INSERT INTO public.probe (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 (
|
|
||||||
'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 (create_date,description,display_name) VALUES (
|
|
||||||
'2017-07-27 20:18:09.555','i am target','ghost target');
|
|
||||||
|
|
||||||
INSERT INTO public.infra (child_id,create_date,probe_id,target_id,type_id) VALUES (
|
|
||||||
1,'2017-07-28 11:08:50.803',1,1,1);
|
|
||||||
INSERT INTO public.infra (child_id,create_date,probe_id,target_id,type_id) VALUES (
|
|
||||||
1,'2017-07-28 11:08:50.832',1,1,3);
|
|
||||||
INSERT INTO public.infra (child_id,create_date,probe_id,target_id,type_id) VALUES (
|
|
||||||
1,'2017-07-28 11:08:50.841',1,1,2);
|
|
||||||
INSERT INTO public.infra (child_id,create_date,type_id,probe_id,target_id) VALUES (
|
|
||||||
1,'2017-07-28 16:52:30.391',7,1,1);
|
|
||||||
|
|
||||||
INSERT INTO public.sensor (crawler_input_items,create_date,description,crawler_id,status,target_id) VALUES (
|
|
||||||
NULL,'2017-06-26 20:19:07.009','My sensor',1,1,1);
|
|
||||||
INSERT INTO public.sensor (crawler_input_items,create_date,description,crawler_id,status,target_id) VALUES (
|
|
||||||
NULL,'2017-06-26 20:19:07.074','My sensor',1,1,1);
|
|
||||||
|
|
||||||
INSERT INTO public.sensor_item (create_date,item_id,sensor_id) VALUES (
|
|
||||||
'2017-06-26 20:21:16.626',1,1);
|
|
||||||
INSERT INTO public.sensor_item (create_date,item_id,sensor_id) VALUES (
|
|
||||||
'2017-06-26 20:21:50.988',2,2);
|
|
|
@ -36,7 +36,7 @@ public class InfraHostServiceTest {
|
||||||
InfraOS infraOS = new InfraOS();
|
InfraOS infraOS = new InfraOS();
|
||||||
infraOS.setId(1);
|
infraOS.setId(1);
|
||||||
|
|
||||||
infraHost.setOs(infraOS);
|
// infraHost.setOs(infraOS);
|
||||||
|
|
||||||
this.infraHostService.regist(infraHost);
|
this.infraHostService.regist(infraHost);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.loafle.overflow.module.infra.service;
|
||||||
|
|
||||||
import com.loafle.overflow.module.infra.model.InfraMachine;
|
import com.loafle.overflow.module.infra.model.InfraMachine;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
||||||
|
import com.loafle.overflow.module.meta.model.MetaInfraVendor;
|
||||||
import com.loafle.overflow.spring.AppConfigTest;
|
import com.loafle.overflow.spring.AppConfigTest;
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -23,13 +25,18 @@ public class InfraMachineServiceTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private InfraMachineService infraMachineService;
|
private InfraMachineService infraMachineService;
|
||||||
|
|
||||||
@Ignore
|
// @Ignore
|
||||||
@Test
|
@Test
|
||||||
public void regist() throws Exception {
|
public void regist() throws Exception {
|
||||||
|
|
||||||
InfraMachine infraMachine = new InfraMachine();
|
InfraMachine infraMachine = new InfraMachine();
|
||||||
|
|
||||||
infraMachine.setMeta("");
|
infraMachine.setMeta("i am a infra machine");
|
||||||
|
|
||||||
|
MetaInfraType metaInfraType = new MetaInfraType();
|
||||||
|
metaInfraType.setId(1);
|
||||||
|
|
||||||
|
infraMachine.setInfraType(metaInfraType);
|
||||||
|
|
||||||
this.infraMachineService.regist(infraMachine);
|
this.infraMachineService.regist(infraMachine);
|
||||||
|
|
||||||
|
@ -40,6 +47,8 @@ public class InfraMachineServiceTest {
|
||||||
@Test
|
@Test
|
||||||
public void read() throws Exception {
|
public void read() throws Exception {
|
||||||
|
|
||||||
|
regist();
|
||||||
|
|
||||||
InfraMachine infraMachine = this.infraMachineService.read(1);
|
InfraMachine infraMachine = this.infraMachineService.read(1);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.loafle.overflow.module.infra.service;
|
||||||
|
|
||||||
import com.loafle.overflow.module.infra.model.InfraMachine;
|
import com.loafle.overflow.module.infra.model.InfraMachine;
|
||||||
import com.loafle.overflow.module.infra.model.InfraOS;
|
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.module.meta.model.MetaInfraVendor;
|
||||||
import com.loafle.overflow.spring.AppConfigTest;
|
import com.loafle.overflow.spring.AppConfigTest;
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
|
@ -23,8 +24,8 @@ public class InfraOSServiceTest {
|
||||||
private InfraOSService infraOSService;
|
private InfraOSService infraOSService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
// @Ignore
|
||||||
public void regist() throws Exception {
|
public void registOS() throws Exception {
|
||||||
|
|
||||||
InfraOS infraOS = new InfraOS();
|
InfraOS infraOS = new InfraOS();
|
||||||
|
|
||||||
|
@ -37,8 +38,14 @@ public class InfraOSServiceTest {
|
||||||
InfraMachine infraMachine = new InfraMachine();
|
InfraMachine infraMachine = new InfraMachine();
|
||||||
infraMachine.setId(1);
|
infraMachine.setId(1);
|
||||||
|
|
||||||
|
MetaInfraType metaInfraType = new MetaInfraType();
|
||||||
|
metaInfraType.setId(3);
|
||||||
|
|
||||||
|
infraOS.setInfraType(metaInfraType);
|
||||||
infraOS.setMachine(infraMachine);
|
infraOS.setMachine(infraMachine);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.infraOSService.regist(infraOS);
|
this.infraOSService.regist(infraOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.loafle.overflow.module.infra.service;
|
||||||
|
|
||||||
import com.loafle.overflow.module.domain.model.Domain;
|
import com.loafle.overflow.module.domain.model.Domain;
|
||||||
import com.loafle.overflow.module.infra.model.Infra;
|
import com.loafle.overflow.module.infra.model.Infra;
|
||||||
|
import com.loafle.overflow.module.infra.model.InfraMachine;
|
||||||
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.probe.model.Probe;
|
||||||
import com.loafle.overflow.module.probe.service.ProbeService;
|
import com.loafle.overflow.module.probe.service.ProbeService;
|
||||||
|
@ -31,52 +32,102 @@ public class InfraServiceTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProbeService probeService;
|
private ProbeService probeService;
|
||||||
|
|
||||||
@Ignore
|
@Autowired
|
||||||
@Test
|
private InfraMachineService infraMachineService;
|
||||||
public void regist() throws Exception {
|
|
||||||
|
|
||||||
long id =registInfra(7,1);
|
|
||||||
Assert.assertNotEquals(id, 0);
|
|
||||||
|
|
||||||
// id =registInfra(3,1);
|
// public void regist() throws Exception {
|
||||||
|
//
|
||||||
|
// long id =registInfra(7,1);
|
||||||
// Assert.assertNotEquals(id, 0);
|
// Assert.assertNotEquals(id, 0);
|
||||||
//
|
//
|
||||||
// id =registInfra(2,1);
|
//// id =registInfra(3,1);
|
||||||
// Assert.assertNotEquals(id, 0);
|
//// Assert.assertNotEquals(id, 0);
|
||||||
|
////
|
||||||
|
//// id =registInfra(2,1);
|
||||||
|
//// Assert.assertNotEquals(id, 0);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void tttt() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Ignore
|
@Test
|
||||||
public long registInfra(int type, int childId) {
|
public void registInfraMachine() {
|
||||||
|
|
||||||
|
InfraMachine infraMachine = new InfraMachine();
|
||||||
|
infraMachine.setMeta("i am a inframachine");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Assert.assertNotEquals(infraMachine.getId(), 0);
|
||||||
|
|
||||||
|
// Probe probe = new Probe();
|
||||||
|
// probe.setId(1);
|
||||||
|
//
|
||||||
|
// Target target = new Target();
|
||||||
|
// target.setId(1);
|
||||||
|
|
||||||
|
// Infra infra = new Infra();
|
||||||
|
// infra.setTarget(target);
|
||||||
|
|
||||||
MetaInfraType metaInfraType = new MetaInfraType();
|
MetaInfraType metaInfraType = new MetaInfraType();
|
||||||
metaInfraType.setId(type);
|
metaInfraType.setId(1);
|
||||||
|
|
||||||
Infra infra = new Infra();
|
// infraMachine.setInfraType(metaInfraType);
|
||||||
infra.setInfraType(metaInfraType);
|
|
||||||
infra.setChildId(childId);
|
|
||||||
|
|
||||||
|
// infra.setProbe(probe);
|
||||||
|
|
||||||
|
// infra.setInfraChild(infraMachine);
|
||||||
|
|
||||||
Probe probe = new Probe();
|
this.infraMachineService.regist(infraMachine);
|
||||||
probe.setId(1);
|
|
||||||
|
|
||||||
Target target = new Target();
|
// this.infraService.regist(infra);
|
||||||
target.setId(1);
|
|
||||||
|
|
||||||
infra.setProbe(probe);
|
// Assert.assertNotEquals(infra.getId(), 0);
|
||||||
infra.setTarget(target);
|
|
||||||
|
|
||||||
this.infraService.regist(infra);
|
|
||||||
|
|
||||||
return infra.getId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void registInfraOS() {
|
||||||
|
registInfraMachine();
|
||||||
|
}
|
||||||
|
|
||||||
|
//// @Ignore
|
||||||
|
// public long registInfra(int type, int childId) {
|
||||||
|
// MetaInfraType metaInfraType = new MetaInfraType();
|
||||||
|
// metaInfraType.setId(type);
|
||||||
|
//
|
||||||
|
// Infra infra = new Infra();
|
||||||
|
// infra.setInfraType(metaInfraType);
|
||||||
|
//// 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);
|
||||||
|
//
|
||||||
|
// return infra.getId();
|
||||||
|
// }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void read() throws Exception {
|
public void read() throws Exception {
|
||||||
|
|
||||||
Infra infra = this.infraService.read(3);
|
// registInfraMachine();
|
||||||
|
|
||||||
|
Infra infra = this.infraService.read(1);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
String json = objectMapper.writeValueAsString(infra);
|
String json = objectMapper.writeValueAsString(infra);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class TargetDiscoveryServiceTest {
|
||||||
Probe probe = new Probe();
|
Probe probe = new Probe();
|
||||||
probe.setId(1);
|
probe.setId(1);
|
||||||
|
|
||||||
this.targetDiscoveryService.saveAllTarget(hosts, probe);
|
// this.targetDiscoveryService.saveAllTarget(hosts, probe);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String readFileAsString(String filePath) throws IOException {
|
private String readFileAsString(String filePath) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user