fixed
probe, infra
This commit is contained in:
parent
7eaf1c41d0
commit
f7742f4be8
|
@ -12,7 +12,7 @@ import java.util.Date;
|
||||||
@Table(name = "INFRA_MACHINE", schema = "public", catalog = "postgres")
|
@Table(name = "INFRA_MACHINE", schema = "public", catalog = "postgres")
|
||||||
public class InfraMachine {
|
public class InfraMachine {
|
||||||
private long id;
|
private long id;
|
||||||
private Probe probe;
|
|
||||||
private String meta;
|
private String meta;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
|
|
||||||
|
@ -32,16 +32,6 @@ public class InfraMachine {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "PROBE_ID", nullable = false)
|
|
||||||
public Probe getProbe() {
|
|
||||||
return probe;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProbe(Probe probe) {
|
|
||||||
this.probe = probe;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "META", nullable = true, length = 255)
|
@Column(name = "META", nullable = true, length = 255)
|
||||||
public String getMeta() {
|
public String getMeta() {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.loafle.overflow.module.probe.model;
|
package com.loafle.overflow.module.probe.model;
|
||||||
|
|
||||||
import com.loafle.overflow.module.domain.model.Domain;
|
import com.loafle.overflow.module.domain.model.Domain;
|
||||||
|
import com.loafle.overflow.module.infra.model.InfraHost;
|
||||||
|
import com.loafle.overflow.module.member.model.Member;
|
||||||
import com.loafle.overflow.module.meta.model.MetaProbeStatus;
|
import com.loafle.overflow.module.meta.model.MetaProbeStatus;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
@ -12,17 +14,8 @@ import java.util.Date;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "PROBE", schema = "public", catalog = "postgres")
|
@Table(name = "PROBE", schema = "public", catalog = "postgres")
|
||||||
public class Probe {
|
public class Probe {
|
||||||
private long id;
|
|
||||||
private MetaProbeStatus status;
|
|
||||||
private String description;
|
|
||||||
private Date createDate;
|
|
||||||
private Date lastPollingDate;
|
|
||||||
private Date nextPollingDate;
|
|
||||||
private Domain domain;
|
|
||||||
private String probeKey;
|
|
||||||
private String encryptionKey;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
domain Domain
|
domain Domain
|
||||||
target count int
|
target count int
|
||||||
sensor count int
|
sensor count int
|
||||||
|
@ -39,6 +32,26 @@ encryptionKey String
|
||||||
status (Meta)
|
status (Meta)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private MetaProbeStatus status;
|
||||||
|
private String description;
|
||||||
|
private Date createDate;
|
||||||
|
|
||||||
|
private Domain domain;
|
||||||
|
private String probeKey;
|
||||||
|
private String encryptionKey;
|
||||||
|
|
||||||
|
// private Date lastPollingDate;
|
||||||
|
// private Date nextPollingDate;
|
||||||
|
|
||||||
|
private int targetCount;
|
||||||
|
private int sensorCount;
|
||||||
|
private String displayName;
|
||||||
|
private String cidr;
|
||||||
|
private Date authorizedDate;
|
||||||
|
private Member authorizedMember;
|
||||||
|
private InfraHost infraHost;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||||
public long getId() {
|
public long getId() {
|
||||||
|
@ -79,26 +92,6 @@ status (Meta)
|
||||||
this.createDate = createDate;
|
this.createDate = createDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
|
||||||
@Column(name = "LAST_POLLING_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
|
|
||||||
public Date getLastPollingDate() {
|
|
||||||
return lastPollingDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastPollingDate(Date lastPollingDate) {
|
|
||||||
this.lastPollingDate = lastPollingDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
|
||||||
@Column(name = "NEXT_POLLING_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
|
|
||||||
public Date getNextPollingDate() {
|
|
||||||
return nextPollingDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNextPollingDate(Date nextPollingDate) {
|
|
||||||
this.nextPollingDate = nextPollingDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "DOMAIN_ID", nullable = false)
|
@JoinColumn(name = "DOMAIN_ID", nullable = false)
|
||||||
public Domain getDomain() {
|
public Domain getDomain() {
|
||||||
|
@ -129,28 +122,69 @@ status (Meta)
|
||||||
this.encryptionKey = encryptionKey;
|
this.encryptionKey = encryptionKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
@Column(name = "TARGET_COUNT", nullable = false)
|
||||||
// public boolean equals(Object o) {
|
public int getTargetCount() {
|
||||||
// if (this == o) return true;
|
return targetCount;
|
||||||
// if (o == null || getClass() != o.getClass()) return false;
|
}
|
||||||
//
|
|
||||||
// Probe tblProbe = (Probe) o;
|
|
||||||
//
|
|
||||||
// if (id != tblProbe.id) return false;
|
|
||||||
// if (domain != tblProbe.domain) return false;
|
|
||||||
// if (status != null ? !status.equals(tblProbe.status) : tblProbe.status != null) return false;
|
|
||||||
// if (description != null ? !description.equals(tblProbe.description) : tblProbe.description != null)
|
|
||||||
// return false;
|
|
||||||
// if (createDate != null ? !createDate.equals(tblProbe.createDate) : tblProbe.createDate != null) return false;
|
|
||||||
// if (lastPollingDate != null ? !lastPollingDate.equals(tblProbe.lastPollingDate) : tblProbe.lastPollingDate != null)
|
|
||||||
// return false;
|
|
||||||
// if (nextPollingDate != null ? !nextPollingDate.equals(tblProbe.nextPollingDate) : tblProbe.nextPollingDate != null)
|
|
||||||
// return false;
|
|
||||||
// if (probeKey != null ? !probeKey.equals(tblProbe.probeKey) : tblProbe.probeKey != null) return false;
|
|
||||||
// if (encryptionKey != null ? !encryptionKey.equals(tblProbe.encryptionKey) : tblProbe.encryptionKey != null)
|
|
||||||
// return false;
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
public void setTargetCount(int targetCount) {
|
||||||
|
this.targetCount = targetCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Column(name = "SENSOR_COUNT", nullable = false)
|
||||||
|
public int getSensorCount() {
|
||||||
|
return sensorCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSensorCount(int sensorCount) {
|
||||||
|
this.sensorCount = sensorCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Column(name = "DISPLAY_NAME")
|
||||||
|
public String getDisplayName() {
|
||||||
|
return displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayName(String displayName) {
|
||||||
|
this.displayName = displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Column(name = "CIDR")
|
||||||
|
public String getCidr() {
|
||||||
|
return cidr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCidr(String cidr) {
|
||||||
|
this.cidr = cidr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
@Column(name = "AUTHORIZED_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||||
|
public Date getAuthorizedDate() {
|
||||||
|
return authorizedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthorizedDate(Date authorizedDate) {
|
||||||
|
this.authorizedDate = authorizedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "MEMBER_ID", nullable = false)
|
||||||
|
public Member getAuthorizedMember() {
|
||||||
|
return authorizedMember;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthorizedMember(Member authorizedMember) {
|
||||||
|
this.authorizedMember = authorizedMember;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "HOST_ID", nullable = false)
|
||||||
|
public InfraHost getInfraHost() {
|
||||||
|
return infraHost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInfraHost(InfraHost infraHost) {
|
||||||
|
this.infraHost = infraHost;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class TargetDiscoveryService {
|
||||||
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);
|
||||||
|
|
|
@ -314,54 +314,6 @@ INSERT INTO public.meta_sensor_item (id,create_date,"key","name",type_id) VALUES
|
||||||
INSERT INTO public.meta_sensor_item (id,create_date,"key","name",type_id) VALUES (
|
INSERT INTO public.meta_sensor_item (id,create_date,"key","name",type_id) VALUES (
|
||||||
4,'2017-06-26 20:10:08.394','mem.free','MEMORY FREE',2);
|
4,'2017-06-26 20:10:08.394','mem.free','MEMORY FREE',2);
|
||||||
|
|
||||||
--
|
|
||||||
--
|
|
||||||
--
|
|
||||||
--
|
|
||||||
--
|
|
||||||
INSERT INTO public."member" (company_name,create_date,email,"name",phone,pw,status_id) VALUES (
|
|
||||||
'loafle','2017-06-26 11:07:27.625','overflow@loafle.com','overFlow','000-000-0000','qwer5795',2);
|
|
||||||
|
|
||||||
INSERT INTO public."member" (company_name,create_date,email,"name",phone,pw,status_id) VALUES (
|
|
||||||
'loafle','2017-06-26 11:07:27.625','geek@loafle.com','geek','000-000-0000','qwer5795',1);
|
|
||||||
|
|
||||||
INSERT INTO public.email_auth (auth_confirm_date,create_date,email_auth_key,member_id) VALUES (
|
|
||||||
NULL,'2017-06-26 15:28:48.895','dbseogns1234',1);
|
|
||||||
|
|
||||||
INSERT INTO public."domain" (create_date,"name") VALUES (
|
|
||||||
'2017-06-26 11:25:44.866','overFlow''s domain');
|
|
||||||
|
|
||||||
INSERT INTO public.domain_member (create_date,domain_id,member_id) VALUES (
|
|
||||||
'2017-06-26 11:27:43.023',1,1);
|
|
||||||
|
|
||||||
INSERT INTO public.api_key (api_key,create_date,domain_id) VALUES (
|
|
||||||
'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.probe (create_date,description,encryption_key,last_polling_date,next_polling_date,probe_key,domain_id,status) VALUES (
|
|
||||||
'2017-06-26 12:44:59.813','snoop probe','9c8d41ab57de11e7a2c9080027658d13',NULL,NULL,'a1e1710557de11e78799080027658d13',1,1);
|
|
||||||
|
|
||||||
INSERT INTO public.infra_machine (create_date,meta,probe_id) VALUES (
|
|
||||||
'2017-06-26 12:12:11.698',NULL,1);
|
|
||||||
|
|
||||||
INSERT INTO public.infra (child_id,create_date,type_id) VALUES (
|
|
||||||
0,'2017-06-26 12:12:11.809',1);
|
|
||||||
|
|
||||||
INSERT INTO public.target (create_date,infra_id,probe_id) VALUES (
|
|
||||||
'2017-06-26 12:37:22.854',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);
|
|
||||||
|
|
||||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||||
1,'2017-07-27 15:29:48.634',23,26);
|
1,'2017-07-27 15:29:48.634',23,26);
|
||||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||||
|
@ -424,3 +376,58 @@ INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VAL
|
||||||
30,'2017-07-27 15:29:48.634',23,62);
|
30,'2017-07-27 15:29:48.634',23,62);
|
||||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||||
31,'2017-07-27 15:29:48.634',24,63);
|
31,'2017-07-27 15:29:48.634',24,63);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO public."member" (id,company_name,create_date,email,"name",phone,pw,status_id) VALUES (
|
||||||
|
1,'loafle','2017-06-26 11:07:27.625','overflow@loafle.com','overFlow','000-000-0000','qwer5795',2);
|
||||||
|
|
||||||
|
INSERT INTO public."member" (id,company_name,create_date,email,"name",phone,pw,status_id) VALUES (
|
||||||
|
2,'loafle','2017-06-26 11:07:27.625','geek@loafle.com','geek','000-000-0000','qwer5795',1);
|
||||||
|
|
||||||
|
INSERT INTO public.email_auth (auth_confirm_date,create_date,email_auth_key,member_id) VALUES (
|
||||||
|
NULL,'2017-06-26 15:28:48.895','dbseogns1234',1);
|
||||||
|
|
||||||
|
INSERT INTO public."domain" (create_date,"name") VALUES (
|
||||||
|
'2017-06-26 11:25:44.866','overFlow''s domain');
|
||||||
|
|
||||||
|
INSERT INTO public.domain_member (create_date,domain_id,member_id) VALUES (
|
||||||
|
'2017-06-26 11:27:43.023',1,1);
|
||||||
|
|
||||||
|
INSERT INTO public.api_key (api_key,create_date,domain_id) VALUES (
|
||||||
|
'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.infra_machine (id,create_date,meta) VALUES (
|
||||||
|
1,'2017-07-27 19:54:26.677','');
|
||||||
|
|
||||||
|
INSERT INTO public.infra_os (id,create_date,meta,machine_id,vendor_id) VALUES (
|
||||||
|
1,'2017-07-27 19:55:47.326','',1,26);
|
||||||
|
|
||||||
|
INSERT INTO public.infra_host (id,create_date,ip,mac,os_id) VALUES (
|
||||||
|
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,authorized_date,cidr,create_date,description,display_name,encryption_key,probe_key,sensor_count,target_count,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);
|
||||||
|
|
||||||
|
INSERT INTO public.target (id,create_date,infra_id,probe_id) VALUES (
|
||||||
|
1,'2017-06-26 12:37:22.854',1,1);
|
||||||
|
|
||||||
|
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);
|
||||||
|
INSERT INTO public.sensor (id,crawler_input_items,create_date,description,crawler_id,status,target_id) VALUES (
|
||||||
|
2,NULL,'2017-06-26 20:19:07.074','My sensor',1,1,1);
|
||||||
|
|
||||||
|
INSERT INTO public.sensor_item (id,create_date,item_id,sensor_id) VALUES (
|
||||||
|
1,'2017-06-26 20:21:16.626',1,1);
|
||||||
|
INSERT INTO public.sensor_item (id,create_date,item_id,sensor_id) VALUES (
|
||||||
|
2,'2017-06-26 20:21:50.988',2,2);
|
|
@ -0,0 +1,50 @@
|
||||||
|
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.spring.AppConfig;
|
||||||
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
|
import com.loafle.overflow.spring.MailConfiguration;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by snoop on 17. 7. 27.
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class})
|
||||||
|
public class InfraHostServiceTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private InfraHostService infraHostService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
InfraHost infraHost = new InfraHost();
|
||||||
|
|
||||||
|
infraHost.setMac(8796753988883L);
|
||||||
|
infraHost.setIp(3232235980L);
|
||||||
|
|
||||||
|
InfraOS infraOS = new InfraOS();
|
||||||
|
infraOS.setId(1);
|
||||||
|
|
||||||
|
infraHost.setOs(infraOS);
|
||||||
|
|
||||||
|
this.infraHostService.regist(infraHost);
|
||||||
|
|
||||||
|
Assert.assertNotEquals(infraHost.getId(), 0 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void read() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.loafle.overflow.module.infra.service;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.infra.model.InfraMachine;
|
||||||
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
|
import com.loafle.overflow.spring.MailConfiguration;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by snoop on 17. 7. 27.
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class})
|
||||||
|
public class InfraMachineServiceTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private InfraMachineService infraMachineService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
InfraMachine infraMachine = new InfraMachine();
|
||||||
|
|
||||||
|
infraMachine.setMeta("");
|
||||||
|
|
||||||
|
this.infraMachineService.regist(infraMachine);
|
||||||
|
|
||||||
|
Assert.assertNotEquals(infraMachine.getId(), 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void read() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.loafle.overflow.module.infra.service;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.infra.model.InfraMachine;
|
||||||
|
import com.loafle.overflow.module.infra.model.InfraOS;
|
||||||
|
import com.loafle.overflow.module.meta.model.MetaInfraVendor;
|
||||||
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
|
import com.loafle.overflow.spring.MailConfiguration;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by snoop on 17. 7. 27.
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class})
|
||||||
|
public class InfraOSServiceTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private InfraOSService infraOSService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
InfraOS infraOS = new InfraOS();
|
||||||
|
|
||||||
|
MetaInfraVendor metaInfraVendor = new MetaInfraVendor();
|
||||||
|
metaInfraVendor.setId(26);
|
||||||
|
|
||||||
|
infraOS.setVendor(metaInfraVendor);
|
||||||
|
infraOS.setMeta("");
|
||||||
|
|
||||||
|
InfraMachine infraMachine = new InfraMachine();
|
||||||
|
infraMachine.setId(1);
|
||||||
|
|
||||||
|
infraOS.setMachine(infraMachine);
|
||||||
|
|
||||||
|
this.infraOSService.regist(infraOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void read() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.loafle.overflow.module.infra.service;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.infra.model.Infra;
|
||||||
|
import com.loafle.overflow.module.meta.model.MetaInfraType;
|
||||||
|
import com.loafle.overflow.module.meta.model.MetaInfraVendor;
|
||||||
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
|
import com.loafle.overflow.spring.MailConfiguration;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by snoop on 17. 7. 27.
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class})
|
||||||
|
public class InfraServiceTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private InfraService infraService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
long id =registInfra(1,1);
|
||||||
|
Assert.assertNotEquals(id, 0);
|
||||||
|
|
||||||
|
id =registInfra(3,1);
|
||||||
|
Assert.assertNotEquals(id, 0);
|
||||||
|
|
||||||
|
id =registInfra(2,1);
|
||||||
|
Assert.assertNotEquals(id, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public long registInfra(int type, int childId) {
|
||||||
|
MetaInfraType metaInfraType = new MetaInfraType();
|
||||||
|
metaInfraType.setId(type);
|
||||||
|
|
||||||
|
Infra infra = new Infra();
|
||||||
|
infra.setType(metaInfraType);
|
||||||
|
infra.setChildId(childId);
|
||||||
|
|
||||||
|
this.infraService.regist(infra);
|
||||||
|
return infra.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void read() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,10 +1,13 @@
|
||||||
package com.loafle.overflow.module.probe.service;
|
package com.loafle.overflow.module.probe.service;
|
||||||
|
|
||||||
import com.loafle.overflow.module.domain.model.Domain;
|
import com.loafle.overflow.module.domain.model.Domain;
|
||||||
|
import com.loafle.overflow.module.infra.model.InfraHost;
|
||||||
|
import com.loafle.overflow.module.member.model.Member;
|
||||||
import com.loafle.overflow.module.meta.model.MetaProbeStatus;
|
import com.loafle.overflow.module.meta.model.MetaProbeStatus;
|
||||||
import com.loafle.overflow.module.probe.model.Probe;
|
import com.loafle.overflow.module.probe.model.Probe;
|
||||||
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 org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -13,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
@ -21,13 +25,13 @@ import static org.junit.Assert.*;
|
||||||
* Created by snoop on 17. 6. 28.
|
* Created by snoop on 17. 6. 28.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class})
|
||||||
public class ProbeServiceTest {
|
public class ProbeServiceTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProbeService probeService;
|
private ProbeService probeService;
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void regist() throws Exception {
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
@ -49,12 +53,27 @@ public class ProbeServiceTest {
|
||||||
|
|
||||||
probe.setStatus(status);
|
probe.setStatus(status);
|
||||||
|
|
||||||
|
probe.setTargetCount(0);
|
||||||
|
probe.setSensorCount(0);
|
||||||
|
probe.setDisplayName("test probe");
|
||||||
|
probe.setCidr("192.168.1.0/24");
|
||||||
|
// probe.setAuthorizedDate(new Date());
|
||||||
|
|
||||||
|
Member member = new Member();
|
||||||
|
member.setId(1l);
|
||||||
|
probe.setAuthorizedMember(member);
|
||||||
|
|
||||||
|
InfraHost infraHost = new InfraHost();
|
||||||
|
infraHost.setId(1);
|
||||||
|
|
||||||
|
probe.setInfraHost(infraHost);
|
||||||
|
|
||||||
this.probeService.regist(probe);
|
this.probeService.regist(probe);
|
||||||
|
|
||||||
Assert.assertNotEquals(probe.getId(), 0);
|
Assert.assertNotEquals(probe.getId(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void readAllByDomain() throws Exception {
|
public void readAllByDomain() throws Exception {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user