From f5491dcc7f30adf0fe4872f1ee455ed5e0b28a94 Mon Sep 17 00:00:00 2001 From: snoop Date: Tue, 27 Jun 2017 14:38:01 +0900 Subject: [PATCH] fixed infra id , date added vendortype --- .../overflow/module/infra/model/Infra.java | 2 +- .../overflow/module/infra/model/InfraHost.java | 14 +++++++------- .../module/infra/model/InfraMachine.java | 2 +- .../overflow/module/infra/model/InfraOS.java | 2 +- .../module/infra/model/InfraOSApplication.java | 2 +- .../module/infra/model/InfraOSDaemon.java | 2 +- .../module/infra/model/InfraOSPort.java | 2 +- .../module/infra/model/InfraService.java | 2 +- src/main/resources/init.sql | 2 ++ .../meta/dao/MetaInfraVendorDAOTest.java | 17 +++++++++++++++++ 10 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/loafle/overflow/module/infra/model/Infra.java b/src/main/java/com/loafle/overflow/module/infra/model/Infra.java index 60dbe62..e5cc0dc 100644 --- a/src/main/java/com/loafle/overflow/module/infra/model/Infra.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/Infra.java @@ -47,7 +47,7 @@ public class Infra { } @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) public Date getCreateDate() { return createDate; } diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraHost.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraHost.java index e17963f..b6dac64 100644 --- a/src/main/java/com/loafle/overflow/module/infra/model/InfraHost.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraHost.java @@ -11,8 +11,8 @@ import java.util.Date; public class InfraHost { private long id; private InfraOS os; - private int ip; - private int mac; + private long ip; + private long mac; private Date createDate; @Id @@ -37,26 +37,26 @@ public class InfraHost { @Basic @Column(name = "IP", nullable = false) - public int getIp() { + public long getIp() { return ip; } - public void setIp(int ip) { + public void setIp(long ip) { this.ip = ip; } @Basic @Column(name = "MAC", nullable = false) - public int getMac() { + public long getMac() { return mac; } - public void setMac(int mac) { + public void setMac(long mac) { this.mac = mac; } @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) public Date getCreateDate() { return createDate; } diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraMachine.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraMachine.java index cfd8212..927f0db 100644 --- a/src/main/java/com/loafle/overflow/module/infra/model/InfraMachine.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraMachine.java @@ -47,7 +47,7 @@ public class InfraMachine { } @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) public Date getCreateDate() { return createDate; } diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraOS.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOS.java index ea08a5a..ad1dea8 100644 --- a/src/main/java/com/loafle/overflow/module/infra/model/InfraOS.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOS.java @@ -48,7 +48,7 @@ public class InfraOS { } @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) public Date getCreateDate() { return createDate; } diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraOSApplication.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSApplication.java index 5ef2407..034e340 100644 --- a/src/main/java/com/loafle/overflow/module/infra/model/InfraOSApplication.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSApplication.java @@ -45,7 +45,7 @@ public class InfraOSApplication { } @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) public Date getCreateDate() { return createDate; } diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraOSDaemon.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSDaemon.java index 90ebdd9..77d06ef 100644 --- a/src/main/java/com/loafle/overflow/module/infra/model/InfraOSDaemon.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSDaemon.java @@ -45,7 +45,7 @@ public class InfraOSDaemon { } @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) public Date getCreateDate() { return createDate; } diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraOSPort.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSPort.java index 3d231a9..19e760c 100644 --- a/src/main/java/com/loafle/overflow/module/infra/model/InfraOSPort.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSPort.java @@ -40,7 +40,7 @@ public class InfraOSPort { } @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) public Date getCreateDate() { return createDate; } diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraService.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraService.java index 192c002..1e3e782 100644 --- a/src/main/java/com/loafle/overflow/module/infra/model/InfraService.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraService.java @@ -70,7 +70,7 @@ public class InfraService { } @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) public Date getCreateDate() { return createDate; } diff --git a/src/main/resources/init.sql b/src/main/resources/init.sql index 9b2079c..087c53a 100644 --- a/src/main/resources/init.sql +++ b/src/main/resources/init.sql @@ -107,6 +107,8 @@ INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( 41,'2017-06-26 20:59:36.385','WMI',7); INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( 42,'2017-06-26 20:59:36.414','SNMP_V2',7); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +43,'2017-06-27 14:32:12.506','UNKNOWN',7); INSERT INTO public.meta_crawler (id,create_date,description,"name") VALUES ( 1,'2017-06-25 17:00:43.869','WMI','WMI_CRAWLER'); diff --git a/src/test/java/com/loafle/overflow/meta/dao/MetaInfraVendorDAOTest.java b/src/test/java/com/loafle/overflow/meta/dao/MetaInfraVendorDAOTest.java index 7b01e69..79fa0a9 100644 --- a/src/test/java/com/loafle/overflow/meta/dao/MetaInfraVendorDAOTest.java +++ b/src/test/java/com/loafle/overflow/meta/dao/MetaInfraVendorDAOTest.java @@ -25,6 +25,23 @@ public class MetaInfraVendorDAOTest { @Autowired private MetaInfraVendorDAO metaInfraVendorDAO; + @Test + public void createOne() { + + int startIdx = 43; + + MetaInfraType typeApp = new MetaInfraType(); + typeApp.setId(7); + + MetaInfraVendor vendor = new MetaInfraVendor(); + vendor.setId(startIdx); + vendor.setMetaInfraType(typeApp); + vendor.setName("UNKNOWN"); + + this.metaInfraVendorDAO.save(vendor); + } + + @Test public void create() {