From df5a93e878615e13779a7ed92e0a092d02417edb Mon Sep 17 00:00:00 2001 From: snoop Date: Thu, 17 Nov 2016 10:53:19 +0900 Subject: [PATCH] fixed zone , hostscan --- .../bridge/discoveryzone/DiscoveryZone.java | 2 +- .../bridge/discoveryzone/HostScanHistory.java | 6 +++--- .../DiscoveryZoneRepositoryTest.java | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java index 31a8b21..5ed6bbe 100644 --- a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java +++ b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java @@ -20,7 +20,7 @@ public class DiscoveryZone { @Column(nullable=false) private long cidr; - @OneToMany(mappedBy = "zone") + @OneToMany(mappedBy = "zone", cascade = CascadeType.ALL) private List hostScanHistories; public List getHostScanHistories() { diff --git a/src/main/java/com/loafle/bridge/discoveryzone/HostScanHistory.java b/src/main/java/com/loafle/bridge/discoveryzone/HostScanHistory.java index eec4a5c..958a138 100644 --- a/src/main/java/com/loafle/bridge/discoveryzone/HostScanHistory.java +++ b/src/main/java/com/loafle/bridge/discoveryzone/HostScanHistory.java @@ -17,13 +17,13 @@ public class HostScanHistory { @Column(nullable=false) private long ip; - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, updatable = false) + @Column(nullable = false, updatable = false) private Date createDate; - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, updatable = false) + @Column(nullable = false, updatable = false) private Date sendDate; - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, updatable = false) + @Column(nullable = false, updatable = false) private Date resultDate; @Column(nullable = false) diff --git a/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java b/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java index 1cd2285..526af42 100644 --- a/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java +++ b/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java @@ -29,7 +29,7 @@ public class DiscoveryZoneRepositoryTest { - @Before +// @Before public void setUp() throws Exception { DiscoveryZone discoveryZone = new DiscoveryZone(); @@ -70,10 +70,10 @@ public class DiscoveryZoneRepositoryTest { } @Test - @Transactional +// @Transactional public void InsertHostHistory() throws Exception { - DiscoveryZone zone = discoveryZoneRepository.findOne((long)1); + DiscoveryZone zone = discoveryZoneRepository.findAll().get(0); HostScanHistory hostScanHistory = null; @@ -110,12 +110,12 @@ public class DiscoveryZoneRepositoryTest { DiscoveryZone zzzz = discoveryZoneRepository.findOne(zone.getId()); - if(zzzz.getHostScanHistories() != null && zzzz.getHostScanHistories().size() > 0) { - System.out.println("zzzz. = " + zzzz.getHostScanHistories().size()); - } - else { - System.out.println("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"); - } +// if(zzzz.getHostScanHistories() != null && zzzz.getHostScanHistories().size() > 0) { +// System.out.println("zzzz. = " + zzzz.getHostScanHistories().size()); +// } +// else { +// System.out.println("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"); +// } }