This commit is contained in:
insanity 2016-11-17 17:26:31 +09:00
parent 3cdc4b2ccf
commit 51331fd9b6
4 changed files with 23 additions and 22 deletions

View File

@ -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() {

View File

@ -28,17 +28,17 @@ public class DiscoveryZone {
private DiscoveryHistory discovery;
@OneToMany(mappedBy = "zone", cascade = CascadeType.ALL)
private List<HostScanHistory> hostScanHistories;
private List<HostScanHistory> histories;
@OneToMany(mappedBy = "zone", cascade = CascadeType.ALL)
private List<DiscoveryHost> discoveryHosts;
public List<HostScanHistory> getHostScanHistories() {
return hostScanHistories;
public List<HostScanHistory> getHistories() {
return histories;
}
public void setHostScanHistories(List<HostScanHistory> hostScanHistories) {
this.hostScanHistories = hostScanHistories;
public void setHistories(List<HostScanHistory> histories) {
this.histories = histories;
}
public List<DiscoveryHost> getDiscoveryHosts() {

View File

@ -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<Collector> list = repo.findAll();
String jsonString = jsonStringFromObject(list);
System.out.println(list);
}
}

View File

@ -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);