From 1e467e64c5314c903561b45cc355fa15a4342952 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 23 Aug 2017 12:56:34 +0900 Subject: [PATCH 1/5] History module --- .../overflow/module/history/History.java | 54 --------- .../module/history/dao/HistoryDAO.java | 10 ++ .../module/history/model/History.java | 104 ++++++++++++++++++ .../history/service/HistoryService.java | 9 ++ .../module/meta/dao/MetaHistoryTypeDAO.java | 13 +++ .../module/meta/model/MetaHistoryType.java | 45 ++++++++ .../meta/service/MetaHistoryTypeService.java | 22 ++++ 7 files changed, 203 insertions(+), 54 deletions(-) delete mode 100644 src/main/java/com/loafle/overflow/module/history/History.java create mode 100644 src/main/java/com/loafle/overflow/module/history/dao/HistoryDAO.java create mode 100644 src/main/java/com/loafle/overflow/module/history/model/History.java create mode 100644 src/main/java/com/loafle/overflow/module/history/service/HistoryService.java create mode 100644 src/main/java/com/loafle/overflow/module/meta/dao/MetaHistoryTypeDAO.java create mode 100644 src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java create mode 100644 src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java diff --git a/src/main/java/com/loafle/overflow/module/history/History.java b/src/main/java/com/loafle/overflow/module/history/History.java deleted file mode 100644 index f449457..0000000 --- a/src/main/java/com/loafle/overflow/module/history/History.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.loafle.overflow.module.history; - -import javax.persistence.*; -import java.util.Date; - -/** - * Created by root on 17. 6. 22. - */ -@Entity -@Table(name = "HISTORY", schema = "public") -public class History { - private long id; - private Date createDate; - - @Id - @GeneratedValue(strategy= GenerationType.IDENTITY) - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false) - public Date getCreateDate() { - return createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - History that = (History) o; - - if (id != that.id) return false; - if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false; - - return true; - } - - @Override - public int hashCode() { - int result = (int) (id ^ (id >>> 32)); - result = 31 * result + (createDate != null ? createDate.hashCode() : 0); - return result; - } -} diff --git a/src/main/java/com/loafle/overflow/module/history/dao/HistoryDAO.java b/src/main/java/com/loafle/overflow/module/history/dao/HistoryDAO.java new file mode 100644 index 0000000..788bf2a --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/history/dao/HistoryDAO.java @@ -0,0 +1,10 @@ +package com.loafle.overflow.module.history.dao; + +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 8. 23. + */ +@Repository +public class HistoryDAO { +} diff --git a/src/main/java/com/loafle/overflow/module/history/model/History.java b/src/main/java/com/loafle/overflow/module/history/model/History.java new file mode 100644 index 0000000..44bfbe3 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/history/model/History.java @@ -0,0 +1,104 @@ +package com.loafle.overflow.module.history.model; + +import com.loafle.overflow.module.member.model.Member; +import com.loafle.overflow.module.meta.model.MetaHistoryType; +import com.loafle.overflow.module.probe.model.Probe; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "HISTORY", schema = "public") +public class History { + private long id; + private Date createDate; + private MetaHistoryType type; + private String message; + private Probe probe; + private Member member; + + //private MetaResultType resultType; // i'm not sure this is necessary + + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @ManyToOne + @JoinColumn(name = "TYPE_ID", nullable = false) + public MetaHistoryType getType() { + return type; + } + + public void setType(MetaHistoryType type) { + this.type = type; + } + + @Column(name = "MESSAGE", nullable = false, length = 255) + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @ManyToOne + @JoinColumn(name = "PROBE_ID", nullable = false) + public Probe getProbe() { + return probe; + } + + public void setProbe(Probe probe) { + this.probe = probe; + } + + @ManyToOne + @JoinColumn(name = "Member_ID", nullable = false) + public Member getMember() { + return member; + } + + public void setMember(Member member) { + this.member = member; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + History that = (History) o; + + if (id != that.id) return false; + if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = (int) (id ^ (id >>> 32)); + result = 31 * result + (createDate != null ? createDate.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/com/loafle/overflow/module/history/service/HistoryService.java b/src/main/java/com/loafle/overflow/module/history/service/HistoryService.java new file mode 100644 index 0000000..e8cb783 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/history/service/HistoryService.java @@ -0,0 +1,9 @@ +package com.loafle.overflow.module.history.service; + +import org.springframework.stereotype.Service; + +@Service("HistoryService") +public class HistoryService { + + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaHistoryTypeDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaHistoryTypeDAO.java new file mode 100644 index 0000000..146708e --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaHistoryTypeDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaInfraType; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaHistoryTypeDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java new file mode 100644 index 0000000..c19ca4e --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java @@ -0,0 +1,45 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_INFRA_TYPE", schema = "public") +public class MetaHistoryType { + private int id; + private String name; + private Date createDate; + + @Id + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java b/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java new file mode 100644 index 0000000..0ba0e43 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java @@ -0,0 +1,22 @@ +package com.loafle.overflow.module.meta.service; + +import com.loafle.overflow.module.meta.dao.MetaHistoryTypeDAO; +import com.loafle.overflow.module.meta.model.MetaInfraType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * Created by snoop on 17. 7. 27. + */ +@Service("MetaInfraTypeService") +public class MetaHistoryTypeService { + + @Autowired + private MetaHistoryTypeDAO hisotyTypeDAO; + + public List readAll() { + return this.hisotyTypeDAO.findAll(); + } +} From dc22b4777d29eeae2692cc05abe7f3fc323a9ccb Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 23 Aug 2017 13:01:22 +0900 Subject: [PATCH 2/5] History module --- .../module/history/dao/HistoryDAO.java | 5 +++- .../module/meta/dao/MetaHistoryTypeDAO.java | 4 +-- .../module/meta/model/MetaHistoryType.java | 2 +- .../meta/service/MetaHistoryTypeService.java | 4 +-- .../service/MetaHistoryTypeServiceTest.java | 30 +++++++++++++++++++ 5 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java diff --git a/src/main/java/com/loafle/overflow/module/history/dao/HistoryDAO.java b/src/main/java/com/loafle/overflow/module/history/dao/HistoryDAO.java index 788bf2a..832cbfc 100644 --- a/src/main/java/com/loafle/overflow/module/history/dao/HistoryDAO.java +++ b/src/main/java/com/loafle/overflow/module/history/dao/HistoryDAO.java @@ -1,10 +1,13 @@ package com.loafle.overflow.module.history.dao; +import com.loafle.overflow.module.history.model.History; +import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; /** * Created by insanity on 17. 8. 23. */ @Repository -public class HistoryDAO { +public interface HistoryDAO extends JpaRepository { + } diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaHistoryTypeDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaHistoryTypeDAO.java index 146708e..9ba663e 100644 --- a/src/main/java/com/loafle/overflow/module/meta/dao/MetaHistoryTypeDAO.java +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaHistoryTypeDAO.java @@ -1,6 +1,6 @@ package com.loafle.overflow.module.meta.dao; -import com.loafle.overflow.module.meta.model.MetaInfraType; +import com.loafle.overflow.module.meta.model.MetaHistoryType; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @@ -8,6 +8,6 @@ import org.springframework.stereotype.Repository; * Created by insanity on 17. 6. 23. */ @Repository -public interface MetaHistoryTypeDAO extends JpaRepository { +public interface MetaHistoryTypeDAO extends JpaRepository { } diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java index c19ca4e..2c71d80 100644 --- a/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java @@ -7,7 +7,7 @@ import java.util.Date; * Created by root on 17. 6. 22. */ @Entity -@Table(name = "META_INFRA_TYPE", schema = "public") +@Table(name = "META_HISTORY_TYPE", schema = "public") public class MetaHistoryType { private int id; private String name; diff --git a/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java b/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java index 0ba0e43..6544f56 100644 --- a/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java +++ b/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java @@ -1,7 +1,7 @@ package com.loafle.overflow.module.meta.service; import com.loafle.overflow.module.meta.dao.MetaHistoryTypeDAO; -import com.loafle.overflow.module.meta.model.MetaInfraType; +import com.loafle.overflow.module.meta.model.MetaHistoryType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -16,7 +16,7 @@ public class MetaHistoryTypeService { @Autowired private MetaHistoryTypeDAO hisotyTypeDAO; - public List readAll() { + public List readAll() { return this.hisotyTypeDAO.findAll(); } } diff --git a/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java b/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java new file mode 100644 index 0000000..b30002d --- /dev/null +++ b/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java @@ -0,0 +1,30 @@ +package com.loafle.overflow.module.meta.service; + +import com.loafle.overflow.module.meta.model.MetaHistoryType; +import com.loafle.overflow.spring.AppConfigTest; +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.List; + +/** + * Created by snoop on 17. 7. 27. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfigTest.class}) +public class MetaHistoryTypeServiceTest { + + @Autowired + private MetaHistoryTypeService historyTypeService; + + @Test + public void readAll() throws Exception { + + List historyTypes = this.historyTypeService.readAll(); + + } + +} \ No newline at end of file From 8d3ed4924de4a45fd1ac6289f1734b40c3fd2f00 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 23 Aug 2017 13:33:01 +0900 Subject: [PATCH 3/5] MetaHistoryType --- .../module/meta/model/MetaHistoryType.java | 2 +- .../meta/service/MetaHistoryTypeService.java | 10 ++++- src/main/resources/init.sql | 16 +++++++ .../service/MetaHistoryTypeServiceTest.java | 45 ++++++++++++++++++- 4 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java index 2c71d80..c605597 100644 --- a/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java @@ -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; } diff --git a/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java b/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java index 6544f56..bf96e9a 100644 --- a/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java +++ b/src/main/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeService.java @@ -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 readAll() { return this.hisotyTypeDAO.findAll(); } + + public MetaHistoryType regist(MetaHistoryType type) { + return this.hisotyTypeDAO.save(type); + } + + public List registAll(List types) { + return this.hisotyTypeDAO.save(types); + } } diff --git a/src/main/resources/init.sql b/src/main/resources/init.sql index 902a811..9bc55b0 100644 --- a/src/main/resources/init.sql +++ b/src/main/resources/init.sql @@ -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 ( diff --git a/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java b/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java index b30002d..fcc3e9d 100644 --- a/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java @@ -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 historyTypes = this.historyTypeService.readAll(); + } + @Test + public void save() throws Exception { + List 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 result = this.historyTypeService.registAll(list); + Assert.assertEquals(result.size(), list.size()); } } \ No newline at end of file From 6045f9c3f49eb8a7ac4c9aef4eb60499312aa4a0 Mon Sep 17 00:00:00 2001 From: snoop Date: Wed, 23 Aug 2017 14:10:57 +0900 Subject: [PATCH 4/5] fix ing infra create --- .../service/TargetDiscoveryService.java | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java b/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java index 5b9b66c..12f3b8b 100644 --- a/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java +++ b/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java @@ -95,16 +95,6 @@ public class TargetDiscoveryService { this.infraHostService.regist(infraHost); -// Infra infraByHost = Infra.CreateInfraByType(infraHost.getId(), InfraHost.class); -// this.infraDAO.save(infraByHost); - -// if(host.isTarget()) { -// Target targetHost = new Target(); -//// targetHost.setInfra(infraByHost); -//// targetHost.setProbe(probe); -// this.targetDAO.save(targetHost); -// } - if(host.getPorts() == null) { continue; } @@ -126,9 +116,6 @@ public class TargetDiscoveryService { infraOSPort.setVendor(MetaInfraVendor.CreateInfraVendorByPort(port.getPortNumber())); this.infraOSPortService.regist(infraOSPort); -// Infra infraByPort = Infra.CreateInfraByType(infraOSPort.getId(), InfraOSPort.class); -// this.infraDAO.save(infraByPort); - if(port.getServices() == null) { continue; } @@ -158,11 +145,6 @@ public class TargetDiscoveryService { this.infraServiceService.regist(infraService); -// Infra infraByService = Infra.CreateInfraByType(infraService.getId(), InfraService.class); -// this.infraDAO.save(infraByService); - - - } } @@ -171,4 +153,14 @@ public class TargetDiscoveryService { } } + + private InfraHost createAndReadHost(Host host, Probe probe) { + + + return null; + } + + + + } From a70ac34ef609b385b15930b1e3fb7779ff7d753e Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 23 Aug 2017 14:17:42 +0900 Subject: [PATCH 5/5] History ing --- .../module/meta/model/MetaHistoryType.java | 8 +++++ .../overflow/module/probe/model/Probe.java | 8 +++++ .../history/service/HistoryServiceTest.java | 34 +++++++++++++++++++ .../service/MetaHistoryTypeServiceTest.java | 3 +- .../service/MetaInfraTypeServiceTest.java | 4 +-- 5 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 src/test/java/com/loafle/overflow/module/history/service/HistoryServiceTest.java diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java index c605597..d619f79 100644 --- a/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaHistoryType.java @@ -13,6 +13,14 @@ public class MetaHistoryType { private String name; private Date createDate; + public MetaHistoryType() { + + } + + public MetaHistoryType(int id) { + this.id = id; + } + @Id public int getId() { return id; diff --git a/src/main/java/com/loafle/overflow/module/probe/model/Probe.java b/src/main/java/com/loafle/overflow/module/probe/model/Probe.java index fc70d18..9a77877 100644 --- a/src/main/java/com/loafle/overflow/module/probe/model/Probe.java +++ b/src/main/java/com/loafle/overflow/module/probe/model/Probe.java @@ -29,6 +29,14 @@ public class Probe { private Member authorizeMember; // private InfraHost host; + public Probe() { + + } + + public Probe(long id) { + this.id = id; + } + @Id @GeneratedValue(strategy= GenerationType.IDENTITY) public long getId() { diff --git a/src/test/java/com/loafle/overflow/module/history/service/HistoryServiceTest.java b/src/test/java/com/loafle/overflow/module/history/service/HistoryServiceTest.java new file mode 100644 index 0000000..611876c --- /dev/null +++ b/src/test/java/com/loafle/overflow/module/history/service/HistoryServiceTest.java @@ -0,0 +1,34 @@ +package com.loafle.overflow.module.history.service; + +import com.loafle.overflow.module.history.model.History; +import com.loafle.overflow.module.member.model.Member; +import com.loafle.overflow.module.probe.model.Probe; +import com.loafle.overflow.spring.AppConfigTest; +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; + +/** + * Created by insanity on 17. 8. 23. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfigTest.class}) +public class HistoryServiceTest { + + @Autowired + private HistoryService historyService; + + @Test + @Ignore + public void registHistories() { + for (int i=0;i<600;i++) { + History h = new History(); + h.setMember(new Member(1)); + h.setProbe(new Probe(1)); + //h.setType(new MetaHistoryType(typeId)); + } + } +} diff --git a/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java b/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java index fcc3e9d..df6ddb5 100644 --- a/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/meta/service/MetaHistoryTypeServiceTest.java @@ -18,15 +18,16 @@ import java.util.List; */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {AppConfigTest.class}) +@Ignore public class MetaHistoryTypeServiceTest { @Autowired private MetaHistoryTypeService historyTypeService; @Test - @Ignore public void readAll() throws Exception { List historyTypes = this.historyTypeService.readAll(); + Assert.assertNotNull(historyTypes); } @Test diff --git a/src/test/java/com/loafle/overflow/module/meta/service/MetaInfraTypeServiceTest.java b/src/test/java/com/loafle/overflow/module/meta/service/MetaInfraTypeServiceTest.java index 5e4d1f0..e89b06a 100644 --- a/src/test/java/com/loafle/overflow/module/meta/service/MetaInfraTypeServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/meta/service/MetaInfraTypeServiceTest.java @@ -3,6 +3,7 @@ package com.loafle.overflow.module.meta.service; import com.loafle.overflow.module.meta.model.MetaInfraType; 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; @@ -11,13 +12,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.util.List; -import static org.junit.Assert.*; - /** * Created by snoop on 17. 7. 27. */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {AppConfigTest.class}) +@Ignore public class MetaInfraTypeServiceTest { @Autowired