EventTest.java
4.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
* @(#)EventTest.java
*
* Copyright (c) 2014-2017 xiniunet 版权所有
* xiniunet. All rights reserved.
*
* This software is the confidential and proprietary
* information of xiniunet.
* ("Confidential Information"). You shall not disclose
* such Confidential Information and shall use it only
* in accordance with the terms of the contract agreement
* you entered into with xiniunet.
*/
package com.xiniunet.system.railway;
import com.xiniunet.framework.data.PagedResult;
import com.xiniunet.framework.security.Passport;
import com.xiniunet.framework.base.BaseTest;
import com.xiniunet.railway.request.*;
import com.xiniunet.railway.response.*;
import com.xiniunet.railway.domain.*;
import com.xiniunet.railway.service.RailwayService;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.transaction.TransactionConfiguration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Date;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
*
* @author xiniunet
*/
@TransactionConfiguration(defaultRollback = false)
public class EventTest extends BaseTest {
@Autowired
private RailwayService railwayService;
@Autowired
private Passport passport;
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testCrudEvent() throws Exception {
Long id;
{
//创建
EventCreateRequest request = new EventCreateRequest();
request.setUserId(12345L);
request.setType("类型");
request.setDescription("事件描述");
request.setDateId("日期ID");
request.setEventTime(new Date());
request.setEventLocation("地点");
request.setStation("车站");
request.setNextStation("下一站");
request.setIsHandled(true);
request.setHandleSuggestion("处理意见");
EventCreateResponse response =railwayService.createEvent(request,passport);
System.out.println(String.format(" id=%d", response.getId()));
assertTrue(response.getId() > 0);
id = response.getId();
}
// {
// //更新
// EventUpdateRequest request = new EventUpdateRequest();
// request.setId(id);
// request.setRowVersion(0L);//并发版本控制
//
// request.setUserId(12345L);
// request.setType("类型");
// request.setDescription("事件描述");
// request.setDateId("日期ID");
// request.setEventTime(new Date());
// request.setEventLocation("地点");
// request.setStation("车站");
// request.setNextStation("下一站");
// request.setIsHandled(true);
// request.setHandleSuggestion("处理意见");
//
// railwayService.updateEvent(request,passport);
// }
//
// {
// //获取
// EventGetRequest request = new EventGetRequest();
// request.setId(id);
//
// EventGetResponse response = railwayService.getEvent(request,passport);
// assertEquals(id, response.getEvent().getId());
// }
//
// {
// //删除
// EventDeleteRequest request=new EventDeleteRequest();
// request.setId(id);
// EventDeleteResponse response = railwayService.deleteEvent(request,passport);
// assertEquals(new Long(1), response.getResult());
// }
}
@Test
public void testSearchEvent(){
EventSearchRequest request=new EventSearchRequest();
EventSearchResponse response=railwayService.searchEvent(request, this.passport);
request.setPageSize(10);
request.setPageNumber(1);
request.setKeyword("");
assertEquals(0, response.getTotalCount());
}
@Test
public void testFindEvent(){
EventFindRequest request=new EventFindRequest();
EventFindResponse response=railwayService.findEvent(request, this.passport);
request.setPageSize(10);
request.setPageNumber(1);
assertEquals(0, response.getTotalCount());
}
}