history model

This commit is contained in:
insanity 2017-08-24 18:47:12 +09:00
parent 9804939eeb
commit a0ee8e6d95
5 changed files with 244 additions and 215 deletions

View File

@ -1,5 +1,6 @@
package com.loafle.overflow.module.history.dao;
import com.loafle.overflow.module.domain.model.Domain;
import com.loafle.overflow.module.history.model.History;
import com.loafle.overflow.module.meta.model.MetaHistoryType;
import com.loafle.overflow.module.probe.model.Probe;
@ -10,7 +11,6 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by insanity on 17. 8. 23.
@ -18,10 +18,10 @@ import java.util.List;
@Repository
public interface HistoryDAO extends JpaRepository<History, Long> {
List<History> findAllByProbeOrderByIdDesc(Probe probe);
Page<History> findAllByProbe(Probe probe, Pageable pageable);
@Query("SELECT h FROM History h WHERE h.probe.id = :#{#probe.id} and h.type.id = :#{#type.id}")
Page<History> findAllByProbeAndType(@Param("probe") Probe probe, @Param("type") MetaHistoryType type, Pageable pageable);
Page<History> findAllByDomain(@Param("domain") Domain domain, Pageable pageRequest);
}

View File

@ -1,5 +1,6 @@
package com.loafle.overflow.module.history.model;
import com.loafle.overflow.module.domain.model.Domain;
import com.loafle.overflow.module.member.model.Member;
import com.loafle.overflow.module.meta.model.MetaHistoryType;
import com.loafle.overflow.module.probe.model.Probe;
@ -19,6 +20,7 @@ public class History {
private String message;
private Probe probe;
private Member member;
private Domain domain;
//private MetaResultType resultType; // i'm not sure this is necessary
@ -73,7 +75,7 @@ public class History {
}
@ManyToOne
@JoinColumn(name = "Member_ID", nullable = false)
@JoinColumn(name = "MEMBER_ID", nullable = false)
public Member getMember() {
return member;
}
@ -82,6 +84,16 @@ public class History {
this.member = member;
}
@ManyToOne
@JoinColumn(name = "DOMAIN_ID", nullable = false)
public Domain getDomain() {
return domain;
}
public void setDomain(Domain domain) {
this.domain = domain;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@ -1,5 +1,6 @@
package com.loafle.overflow.module.history.service;
import com.loafle.overflow.module.domain.model.Domain;
import com.loafle.overflow.module.history.dao.HistoryDAO;
import com.loafle.overflow.module.history.model.History;
import com.loafle.overflow.module.meta.model.MetaHistoryType;
@ -36,4 +37,11 @@ public class HistoryService {
new PageRequest(pageNo, countPerPage, new Sort(Sort.Direction.DESC, "id"));
return this.historyDAO.findAllByProbe(probe, pageRequest);
}
public Page<History> readAllByDomain(Domain domain, int pageNo, int countPerPage) {
Pageable pageRequest =
new PageRequest(pageNo, countPerPage, new Sort(Sort.Direction.DESC, "id"));
return this.historyDAO.findAllByDomain(domain, pageRequest);
}
}

View File

@ -493,6 +493,206 @@ INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_ad
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
1,'2017-08-24 18:33:25.427','Test History 0',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
2,'2017-08-24 18:33:25.472','Test History 1',1,1,1,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
3,'2017-08-24 18:33:25.493','Test History 2',1,1,2,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
4,'2017-08-24 18:33:25.518','Test History 3',1,1,1,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
5,'2017-08-24 18:33:25.543','Test History 4',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
6,'2017-08-24 18:33:25.563','Test History 5',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
7,'2017-08-24 18:33:25.582','Test History 6',1,1,2,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
8,'2017-08-24 18:33:25.601','Test History 7',1,1,1,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
9,'2017-08-24 18:33:25.621','Test History 8',1,1,2,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
10,'2017-08-24 18:33:25.641','Test History 9',1,1,1,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
11,'2017-08-24 18:33:25.660','Test History 10',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
12,'2017-08-24 18:33:25.674','Test History 11',1,1,1,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
13,'2017-08-24 18:33:25.687','Test History 12',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
14,'2017-08-24 18:33:25.701','Test History 13',1,1,2,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
15,'2017-08-24 18:33:25.714','Test History 14',1,1,2,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
16,'2017-08-24 18:33:25.731','Test History 15',1,1,2,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
17,'2017-08-24 18:33:25.747','Test History 16',1,1,2,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
18,'2017-08-24 18:33:25.762','Test History 17',1,1,2,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
19,'2017-08-24 18:33:25.778','Test History 18',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
20,'2017-08-24 18:33:25.793','Test History 19',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
21,'2017-08-24 18:33:25.808','Test History 20',1,1,2,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
22,'2017-08-24 18:33:25.823','Test History 21',1,1,2,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
23,'2017-08-24 18:33:25.839','Test History 22',1,1,2,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
24,'2017-08-24 18:33:25.854','Test History 23',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
25,'2017-08-24 18:33:25.873','Test History 24',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
26,'2017-08-24 18:33:25.888','Test History 25',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
27,'2017-08-24 18:33:25.902','Test History 26',1,1,2,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
28,'2017-08-24 18:33:25.917','Test History 27',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
29,'2017-08-24 18:33:25.929','Test History 28',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
30,'2017-08-24 18:33:25.942','Test History 29',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
31,'2017-08-24 18:33:25.954','Test History 30',1,1,2,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
32,'2017-08-24 18:33:25.968','Test History 31',1,1,2,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
33,'2017-08-24 18:33:25.981','Test History 32',1,1,1,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
34,'2017-08-24 18:33:25.994','Test History 33',1,1,2,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
35,'2017-08-24 18:33:26.007','Test History 34',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
36,'2017-08-24 18:33:26.021','Test History 35',1,1,2,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
37,'2017-08-24 18:33:26.033','Test History 36',1,1,2,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
38,'2017-08-24 18:33:26.045','Test History 37',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
39,'2017-08-24 18:33:26.059','Test History 38',1,1,2,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
40,'2017-08-24 18:33:26.072','Test History 39',1,1,2,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
41,'2017-08-24 18:33:26.084','Test History 40',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
42,'2017-08-24 18:33:26.097','Test History 41',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
43,'2017-08-24 18:33:26.111','Test History 42',1,1,2,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
44,'2017-08-24 18:33:26.123','Test History 43',1,1,2,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
45,'2017-08-24 18:33:26.135','Test History 44',1,1,2,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
46,'2017-08-24 18:33:26.148','Test History 45',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
47,'2017-08-24 18:33:26.160','Test History 46',1,1,1,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
48,'2017-08-24 18:33:26.173','Test History 47',1,1,2,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
49,'2017-08-24 18:33:26.190','Test History 48',1,1,2,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
50,'2017-08-24 18:33:26.204','Test History 49',1,1,2,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
51,'2017-08-24 18:33:26.219','Test History 50',1,1,2,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
52,'2017-08-24 18:33:26.239','Test History 51',1,1,2,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
53,'2017-08-24 18:33:26.261','Test History 52',1,1,1,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
54,'2017-08-24 18:33:26.560','Test History 53',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
55,'2017-08-24 18:33:26.583','Test History 54',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
56,'2017-08-24 18:33:26.600','Test History 55',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
57,'2017-08-24 18:33:26.617','Test History 56',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
58,'2017-08-24 18:33:26.632','Test History 57',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
59,'2017-08-24 18:33:26.646','Test History 58',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
60,'2017-08-24 18:33:26.661','Test History 59',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
61,'2017-08-24 18:33:26.676','Test History 60',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
62,'2017-08-24 18:33:26.692','Test History 61',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
63,'2017-08-24 18:33:26.708','Test History 62',1,1,1,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
64,'2017-08-24 18:33:26.722','Test History 63',1,1,2,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
65,'2017-08-24 18:33:26.734','Test History 64',1,1,2,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
66,'2017-08-24 18:33:26.747','Test History 65',1,1,1,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
67,'2017-08-24 18:33:26.758','Test History 66',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
68,'2017-08-24 18:33:26.771','Test History 67',1,1,1,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
69,'2017-08-24 18:33:26.784','Test History 68',1,1,2,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
70,'2017-08-24 18:33:26.798','Test History 69',1,1,2,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
71,'2017-08-24 18:33:26.813','Test History 70',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
72,'2017-08-24 18:33:26.834','Test History 71',1,1,2,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
73,'2017-08-24 18:33:26.846','Test History 72',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
74,'2017-08-24 18:33:26.859','Test History 73',1,1,1,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
75,'2017-08-24 18:33:26.873','Test History 74',1,1,2,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
76,'2017-08-24 18:33:26.889','Test History 75',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
77,'2017-08-24 18:33:26.905','Test History 76',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
78,'2017-08-24 18:33:26.921','Test History 77',1,1,2,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
79,'2017-08-24 18:33:26.935','Test History 78',1,1,2,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
80,'2017-08-24 18:33:26.948','Test History 79',1,1,2,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
81,'2017-08-24 18:33:26.961','Test History 80',1,1,2,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
82,'2017-08-24 18:33:26.974','Test History 81',1,1,1,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
83,'2017-08-24 18:33:26.987','Test History 82',1,1,2,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
84,'2017-08-24 18:33:27.000','Test History 83',1,1,1,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
85,'2017-08-24 18:33:27.013','Test History 84',1,1,1,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
86,'2017-08-24 18:33:27.025','Test History 85',1,1,2,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
87,'2017-08-24 18:33:27.038','Test History 86',1,1,1,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
88,'2017-08-24 18:33:27.052','Test History 87',1,1,2,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
89,'2017-08-24 18:33:27.064','Test History 88',1,1,2,3);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
90,'2017-08-24 18:33:27.076','Test History 89',1,1,2,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
91,'2017-08-24 18:33:27.090','Test History 90',1,1,2,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
92,'2017-08-24 18:33:27.106','Test History 91',1,1,2,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
93,'2017-08-24 18:33:27.120','Test History 92',1,1,1,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
94,'2017-08-24 18:33:27.134','Test History 93',1,1,1,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
95,'2017-08-24 18:33:27.149','Test History 94',1,1,1,4);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
96,'2017-08-24 18:33:27.164','Test History 95',1,1,2,6);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
97,'2017-08-24 18:33:27.177','Test History 96',1,1,2,2);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
98,'2017-08-24 18:33:27.191','Test History 97',1,1,1,1);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
99,'2017-08-24 18:33:27.204','Test History 98',1,1,2,5);
INSERT INTO public.history (id,create_date,message,domain_id,member_id,probe_id,type_id) VALUES (
100,'2017-08-24 18:33:27.217','Test History 99',1,1,1,3);
@ -514,205 +714,3 @@ INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_ad
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
1,'2017-08-23 15:22:39.851','Test History 0',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
2,'2017-08-23 15:22:39.881','Test History 1',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
3,'2017-08-23 15:22:39.899','Test History 2',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
4,'2017-08-23 15:22:39.915','Test History 3',1,2,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
5,'2017-08-23 15:22:39.929','Test History 4',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
6,'2017-08-23 15:22:39.944','Test History 5',1,2,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
7,'2017-08-23 15:22:39.959','Test History 6',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
8,'2017-08-23 15:22:39.974','Test History 7',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
9,'2017-08-23 15:22:39.987','Test History 8',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
10,'2017-08-23 15:22:40.001','Test History 9',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
11,'2017-08-23 15:22:40.014','Test History 10',1,2,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
12,'2017-08-23 15:22:40.028','Test History 11',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
13,'2017-08-23 15:22:40.041','Test History 12',1,2,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
14,'2017-08-23 15:22:40.056','Test History 13',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
15,'2017-08-23 15:22:40.069','Test History 14',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
16,'2017-08-23 15:22:40.083','Test History 15',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
17,'2017-08-23 15:22:40.096','Test History 16',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
18,'2017-08-23 15:22:40.108','Test History 17',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
19,'2017-08-23 15:22:40.120','Test History 18',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
20,'2017-08-23 15:22:40.133','Test History 19',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
21,'2017-08-23 15:22:40.146','Test History 20',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
22,'2017-08-23 15:22:40.159','Test History 21',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
23,'2017-08-23 15:22:40.172','Test History 22',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
24,'2017-08-23 15:22:40.186','Test History 23',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
25,'2017-08-23 15:22:40.198','Test History 24',1,2,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
26,'2017-08-23 15:22:40.212','Test History 25',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
27,'2017-08-23 15:22:40.224','Test History 26',1,2,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
28,'2017-08-23 15:22:40.235','Test History 27',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
29,'2017-08-23 15:22:40.245','Test History 28',1,2,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
30,'2017-08-23 15:22:40.258','Test History 29',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
31,'2017-08-23 15:22:40.269','Test History 30',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
32,'2017-08-23 15:22:40.284','Test History 31',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
33,'2017-08-23 15:22:40.297','Test History 32',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
34,'2017-08-23 15:22:40.308','Test History 33',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
35,'2017-08-23 15:22:40.319','Test History 34',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
36,'2017-08-23 15:22:40.333','Test History 35',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
37,'2017-08-23 15:22:40.344','Test History 36',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
38,'2017-08-23 15:22:40.357','Test History 37',1,2,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
39,'2017-08-23 15:22:40.369','Test History 38',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
40,'2017-08-23 15:22:40.380','Test History 39',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
41,'2017-08-23 15:22:40.390','Test History 40',1,2,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
42,'2017-08-23 15:22:40.400','Test History 41',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
43,'2017-08-23 15:22:40.412','Test History 42',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
44,'2017-08-23 15:22:40.423','Test History 43',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
45,'2017-08-23 15:22:40.434','Test History 44',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
46,'2017-08-23 15:22:40.448','Test History 45',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
47,'2017-08-23 15:22:40.461','Test History 46',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
48,'2017-08-23 15:22:40.472','Test History 47',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
49,'2017-08-23 15:22:40.483','Test History 48',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
50,'2017-08-23 15:22:40.494','Test History 49',1,2,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
51,'2017-08-23 15:22:40.504','Test History 50',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
52,'2017-08-23 15:22:40.515','Test History 51',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
53,'2017-08-23 15:22:40.529','Test History 52',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
54,'2017-08-23 15:22:40.541','Test History 53',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
55,'2017-08-23 15:22:40.553','Test History 54',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
56,'2017-08-23 15:22:40.567','Test History 55',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
57,'2017-08-23 15:22:40.578','Test History 56',1,2,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
58,'2017-08-23 15:22:40.590','Test History 57',1,2,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
59,'2017-08-23 15:22:40.602','Test History 58',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
60,'2017-08-23 15:22:40.616','Test History 59',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
61,'2017-08-23 15:22:40.627','Test History 60',1,2,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
62,'2017-08-23 15:22:40.638','Test History 61',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
63,'2017-08-23 15:22:40.651','Test History 62',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
64,'2017-08-23 15:22:40.663','Test History 63',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
65,'2017-08-23 15:22:40.674','Test History 64',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
66,'2017-08-23 15:22:40.686','Test History 65',1,2,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
67,'2017-08-23 15:22:40.696','Test History 66',1,2,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
68,'2017-08-23 15:22:40.708','Test History 67',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
69,'2017-08-23 15:22:40.719','Test History 68',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
70,'2017-08-23 15:22:40.729','Test History 69',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
71,'2017-08-23 15:22:40.742','Test History 70',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
72,'2017-08-23 15:22:40.755','Test History 71',1,2,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
73,'2017-08-23 15:22:40.769','Test History 72',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
74,'2017-08-23 15:22:40.785','Test History 73',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
75,'2017-08-23 15:22:40.796','Test History 74',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
76,'2017-08-23 15:22:40.808','Test History 75',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
77,'2017-08-23 15:22:40.820','Test History 76',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
78,'2017-08-23 15:22:40.835','Test History 77',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
79,'2017-08-23 15:22:40.849','Test History 78',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
80,'2017-08-23 15:22:40.861','Test History 79',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
81,'2017-08-23 15:22:40.873','Test History 80',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
82,'2017-08-23 15:22:40.884','Test History 81',1,1,6);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
83,'2017-08-23 15:22:40.896','Test History 82',1,2,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
84,'2017-08-23 15:22:40.907','Test History 83',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
85,'2017-08-23 15:22:40.921','Test History 84',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
86,'2017-08-23 15:22:40.932','Test History 85',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
87,'2017-08-23 15:22:40.945','Test History 86',1,1,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
88,'2017-08-23 15:22:40.956','Test History 87',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
89,'2017-08-23 15:22:40.968','Test History 88',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
90,'2017-08-23 15:22:40.979','Test History 89',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
91,'2017-08-23 15:22:40.992','Test History 90',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
92,'2017-08-23 15:22:41.005','Test History 91',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
93,'2017-08-23 15:22:41.028','Test History 92',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
94,'2017-08-23 15:22:41.064','Test History 93',1,2,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
95,'2017-08-23 15:22:41.095','Test History 94',1,1,2);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
96,'2017-08-23 15:22:41.118','Test History 95',1,1,1);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
97,'2017-08-23 15:22:41.138','Test History 96',1,1,4);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
98,'2017-08-23 15:22:41.148','Test History 97',1,2,3);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
99,'2017-08-23 15:22:41.158','Test History 98',1,1,5);
INSERT INTO public.history (id,create_date,message,member_id,probe_id,type_id) VALUES (
100,'2017-08-23 15:22:41.168','Test History 99',1,1,4);

View File

@ -1,14 +1,17 @@
package com.loafle.overflow.module.history.service;
import com.loafle.overflow.module.domain.model.Domain;
import com.loafle.overflow.module.history.model.History;
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 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.data.domain.Page;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ -27,13 +30,13 @@ public class HistoryServiceTest {
@Test
@Ignore
public void registHistories() {
Random rand = new Random();
for (int i=0;i<100;i++) {
History h = new History();
h.setMember(new Member(1));
h.setProbe(new Probe(1));
Random rand = new Random();
int randomNum = rand.nextInt((6 - 1) + 1) + 1;
h.setType(new MetaHistoryType(randomNum));
h.setProbe(new Probe(rand.nextBoolean() ? 1 : 2));
h.setDomain(new Domain(1));
h.setType(new MetaHistoryType(rand.nextInt((6 - 1) + 1) + 1));
h.setMessage("Test History " + i);
this.historyService.regist(h);
}
@ -47,9 +50,17 @@ public class HistoryServiceTest {
// Assert.assertNotNull(result);
// }
// @Test
// public void readAllByProbeWithPaging() {
// List<History> result = this.historyService.readAllByProbe(new Probe(1), 0, 10);
// Assert.assertEquals(10, result.size());
// }
@Test
@Ignore
public void readAllByProbe() {
Page<History> result = this.historyService.readAllByProbe(new Probe(1), 0, 10);
Assert.assertEquals(10, result.getContent().size());
}
@Test
@Ignore
public void readAllByDomain() {
Page<History> result = this.historyService.readAllByDomain(new Domain(1), 0, 10);
Assert.assertNotNull(result.getContent());
}
}