From 51331fd9b62d6d3497443900adb46b08335e24f4 Mon Sep 17 00:00:00 2001 From: insanity Date: Thu, 17 Nov 2016 17:26:31 +0900 Subject: [PATCH] naming --- .../com/loafle/bridge/collector/Collector.java | 12 ++++++------ .../bridge/discoveryzone/DiscoveryZone.java | 10 +++++----- .../collector/CollectorControllerTest.java | 16 +++++++++++----- .../DiscoveryZoneRepositoryTest.java | 7 +------ 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/loafle/bridge/collector/Collector.java b/src/main/java/com/loafle/bridge/collector/Collector.java index dd8e04a..42dad8b 100644 --- a/src/main/java/com/loafle/bridge/collector/Collector.java +++ b/src/main/java/com/loafle/bridge/collector/Collector.java @@ -1,8 +1,5 @@ package com.loafle.bridge.collector; -import org.hibernate.annotations.Generated; -import org.hibernate.annotations.GenerationTime; - import javax.persistence.*; import java.util.Date; @@ -24,18 +21,21 @@ public class Collector { private String version; @Enumerated(EnumType.STRING) + @Column(nullable = false) private LicenseType licenseType; - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @Temporal(TemporalType.TIMESTAMP) + @Column(nullable = false) private Date licenseDueDate; @Column(nullable = false) private String configPath; - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false) + @Temporal(TemporalType.TIMESTAMP) + @Column(nullable = false) private Date installDate; - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false) + @Temporal(TemporalType.TIMESTAMP) private Date updateDate; public Collector() { diff --git a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java index 9e5e983..eaa81c4 100644 --- a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java +++ b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java @@ -28,17 +28,17 @@ public class DiscoveryZone { private DiscoveryHistory discovery; @OneToMany(mappedBy = "zone", cascade = CascadeType.ALL) - private List hostScanHistories; + private List histories; @OneToMany(mappedBy = "zone", cascade = CascadeType.ALL) private List discoveryHosts; - public List getHostScanHistories() { - return hostScanHistories; + public List getHistories() { + return histories; } - public void setHostScanHistories(List hostScanHistories) { - this.hostScanHistories = hostScanHistories; + public void setHistories(List histories) { + this.histories = histories; } public List getDiscoveryHosts() { diff --git a/src/test/java/com/loafle/bridge/collector/CollectorControllerTest.java b/src/test/java/com/loafle/bridge/collector/CollectorControllerTest.java index 1996be4..c71aef0 100644 --- a/src/test/java/com/loafle/bridge/collector/CollectorControllerTest.java +++ b/src/test/java/com/loafle/bridge/collector/CollectorControllerTest.java @@ -16,6 +16,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.Date; +import java.util.List; import static org.hamcrest.CoreMatchers.equalTo; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; @@ -32,17 +33,13 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standal @WebIntegrationTest public class CollectorControllerTest { + Logger l = Logger.getLogger(this.getClass()); private MockMvc mockMvc; - @Autowired private CollectorRepository repo; - @Autowired private CollectorController controller; - Logger l = Logger.getLogger(this.getClass()); - - @Before public void Before() { @@ -81,5 +78,14 @@ public class CollectorControllerTest { } + @Test + public void TestGelAllCollector() throws Exception { + + List list = repo.findAll(); + String jsonString = jsonStringFromObject(list); + + System.out.println(list); + } + } \ No newline at end of file diff --git a/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java b/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java index 526af42..2190633 100644 --- a/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java +++ b/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java @@ -2,21 +2,16 @@ package com.loafle.bridge.discoveryzone; import com.loafle.bridge.Application; import org.junit.After; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; import java.util.List; -import static org.junit.Assert.*; - /** * Created by snoop on 16. 11. 16. */ @@ -102,7 +97,7 @@ public class DiscoveryZoneRepositoryTest { } - zone.setHostScanHistories(hostScanHistories); + zone.setHistories(hostScanHistories); discoveryZoneRepository.save(zone);