MetaHistoryType

This commit is contained in:
insanity 2017-08-23 13:33:01 +09:00
parent dc22b4777d
commit 8d3ed4924d
4 changed files with 70 additions and 3 deletions

View File

@ -33,7 +33,7 @@ public class MetaHistoryType {
}
@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() {
return createDate;
}

View File

@ -10,7 +10,7 @@ import java.util.List;
/**
* Created by snoop on 17. 7. 27.
*/
@Service("MetaInfraTypeService")
@Service("MetaHistoryTypeService")
public class MetaHistoryTypeService {
@Autowired
@ -19,4 +19,12 @@ public class MetaHistoryTypeService {
public List<MetaHistoryType> readAll() {
return this.hisotyTypeDAO.findAll();
}
public MetaHistoryType regist(MetaHistoryType type) {
return this.hisotyTypeDAO.save(type);
}
public List<MetaHistoryType> registAll(List<MetaHistoryType> types) {
return this.hisotyTypeDAO.save(types);
}
}

View File

@ -377,6 +377,22 @@ INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VAL
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
31,'2017-07-27 15:29:48.634',24,63);
INSERT INTO public.meta_history_type (id,create_date,"name") VALUES (
1,'2017-08-23 13:28:26.966','Member');
INSERT INTO public.meta_history_type (id,create_date,"name") VALUES (
2,'2017-08-23 13:28:26.966','Probe');
INSERT INTO public.meta_history_type (id,create_date,"name") VALUES (
3,'2017-08-23 13:28:26.966','Discovery');
INSERT INTO public.meta_history_type (id,create_date,"name") VALUES (
4,'2017-08-23 13:28:26.966','Target');
INSERT INTO public.meta_history_type (id,create_date,"name") VALUES (
5,'2017-08-23 13:28:26.966','Crawler');
INSERT INTO public.meta_history_type (id,create_date,"name") VALUES (
6,'2017-08-23 13:28:26.966','Sensor');
INSERT INTO public."member" (company_name,create_date,email,"name",phone,pw,status_id) VALUES (

View File

@ -2,12 +2,15 @@ package com.loafle.overflow.module.meta.service;
import com.loafle.overflow.module.meta.model.MetaHistoryType;
import com.loafle.overflow.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Ignore;
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;
/**
@ -21,10 +24,50 @@ public class MetaHistoryTypeServiceTest {
private MetaHistoryTypeService historyTypeService;
@Test
@Ignore
public void readAll() throws Exception {
List<MetaHistoryType> historyTypes = this.historyTypeService.readAll();
}
@Test
public void save() throws Exception {
List<MetaHistoryType> list = new ArrayList<>();
MetaHistoryType t1 = new MetaHistoryType();
t1.setId(1);
t1.setName("Member");
MetaHistoryType t2 = new MetaHistoryType();
t2.setId(2);
t2.setName("Probe");
MetaHistoryType t3 = new MetaHistoryType();
t3.setId(3);
t3.setName("Discovery");
MetaHistoryType t4 = new MetaHistoryType();
t4.setId(4);
t4.setName("Target");
MetaHistoryType t5 = new MetaHistoryType();
t5.setId(5);
t5.setName("Crawler");
MetaHistoryType t6 = new MetaHistoryType();
t6.setId(6);
t6.setName("Sensor");
//todo: need more
list.add(t1);
list.add(t2);
list.add(t3);
list.add(t4);
list.add(t5);
list.add(t6);
List<MetaHistoryType> result = this.historyTypeService.registAll(list);
Assert.assertEquals(result.size(), list.size());
}
}