probe task
This commit is contained in:
snoop 2017-06-26 15:59:28 +09:00
parent 909a7bd585
commit be4f579d3a
4 changed files with 55 additions and 29 deletions

View File

@ -43,7 +43,7 @@ public class MetaProbeTaskType {
} }
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_DATE", nullable = false) @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
public Date getCreateDate() { public Date getCreateDate() {
return createDate; return createDate;
} }

View File

@ -51,27 +51,6 @@ public class ProbeTask {
this.probe = probe; this.probe = probe;
} }
// @Basic
// @Column(name = "TYPE_ID", nullable = false)
// public short getTypeId() {
// return typeId;
// }
//
// public void setTypeId(short typeId) {
// this.typeId = typeId;
// }
//
// @Basic
// @Column(name = "PROBE_ID", nullable = false)
// public long getProbeId() {
// return probeId;
// }
//
// public void setProbeId(long probeId) {
// this.probeId = probeId;
// }
@Basic
@Column(name = "DATA", nullable = true, length = 255) @Column(name = "DATA", nullable = true, length = 255)
public String getData() { public String getData() {
return data; return data;
@ -81,8 +60,7 @@ public class ProbeTask {
this.data = data; this.data = data;
} }
@Basic @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
@Column(name = "CREATE_DATE", nullable = false)
public Date getCreateDate() { public Date getCreateDate() {
return createDate; return createDate;
} }
@ -91,7 +69,6 @@ public class ProbeTask {
this.createDate = createDate; this.createDate = createDate;
} }
@Basic
@Column(name = "SEND_DATE", nullable = true) @Column(name = "SEND_DATE", nullable = true)
public Date getSendDate() { public Date getSendDate() {
return sendDate; return sendDate;
@ -101,7 +78,6 @@ public class ProbeTask {
this.sendDate = sendDate; this.sendDate = sendDate;
} }
@Basic
@Column(name = "START_DATE", nullable = true) @Column(name = "START_DATE", nullable = true)
public Date getStartDate() { public Date getStartDate() {
return startDate; return startDate;
@ -111,7 +87,6 @@ public class ProbeTask {
this.startDate = startDate; this.startDate = startDate;
} }
@Basic
@Column(name = "END_DATE", nullable = true) @Column(name = "END_DATE", nullable = true)
public Date getEndDate() { public Date getEndDate() {
return endDate; return endDate;
@ -121,7 +96,6 @@ public class ProbeTask {
this.endDate = endDate; this.endDate = endDate;
} }
@Basic
@Column(name = "SUCCEED", nullable = true) @Column(name = "SUCCEED", nullable = true)
public Boolean getSucceed() { public Boolean getSucceed() {
return succeed; return succeed;

View File

@ -238,4 +238,7 @@ INSERT INTO public.infra (id,child_id,create_date,type_id) VALUES (
1,0,'2017-06-26 12:12:11.809',1); 1,0,'2017-06-26 12:12:11.809',1);
INSERT INTO public.target (id,create_date,infra_id,probe_id) VALUES ( INSERT INTO public.target (id,create_date,infra_id,probe_id) VALUES (
1,'2017-06-26 12:37:22.854',1,1); 1,'2017-06-26 12:37:22.854',1,1);
INSERT INTO public.meta_probe_task_type (id,create_date,description,"name") VALUES (
1,'2017-06-26 15:58:02.397','DISCOVERY START','DISCOVERY');

View File

@ -0,0 +1,49 @@
package com.loafle.overflow.meta.dao;
import com.loafle.overflow.AppConfig;
import com.loafle.overflow.JdbcConfiguration;
import com.loafle.overflow.meta.model.MetaProbeTaskType;
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 java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
/**
* Created by snoop on 17. 6. 26.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
public class MetaProbeTaskTypeDAOTest {
@Autowired
private MetaProbeTaskTypeDAO metaProbeTaskTypeDAO;
@Test
public void Create() {
MetaProbeTaskType metaDiscovery = new MetaProbeTaskType();
metaDiscovery.setDescription("DISCOVERY START");
metaDiscovery.setName("DISCOVERY");
List<MetaProbeTaskType> pttlist = new ArrayList<>();
pttlist.add(metaDiscovery);
for(int indexI = 1; indexI <= pttlist.size() ;++indexI) {
MetaProbeTaskType type = pttlist.get(indexI - 1);
type.setId((short)indexI);
this.metaProbeTaskTypeDAO.save(type);
}
}
}