Skip to content

Commit 9b25ffc

Browse files
committed
## 2.4.7
* fixed #383 F006 Page after first successful Login: change from inbox to today
1 parent 79ccb79 commit 9b25ffc

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

src/main/java/org/woehlke/java/simpleworklist/domain/db/data/context/ContextServiceImpl.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import java.util.List;
1616
import java.util.Optional;
17+
import java.util.UUID;
1718

1819
/**
1920
* Created by tw on 13.03.16.
@@ -43,6 +44,9 @@ public List<Context> getAllForUser(UserAccount user) {
4344
@Override
4445
public Context findByIdAndUserAccount(long newContextId, UserAccount userAccount) {
4546
log.info("findByIdAndUserAccount");
47+
if(userAccount.getUuid()==null){
48+
userAccount.setUuid(UUID.randomUUID());
49+
}
4650
if(newContextId == 0){
4751
newContextId = userAccount.getDefaultContext().getId();
4852
}
@@ -53,7 +57,11 @@ public Context findByIdAndUserAccount(long newContextId, UserAccount userAccount
5357
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
5458
public Context createNewContext(NewContextForm newContext, UserAccount user) {
5559
log.info("createNewContext");
60+
if(user.getUuid()==null){
61+
user.setUuid(UUID.randomUUID());
62+
}
5663
Context context = new Context();
64+
context.setUuid(UUID.randomUUID());
5765
context.setNameEn(newContext.getNameEn());
5866
context.setNameDe(newContext.getNameDe());
5967
context.setUserAccount(user);
@@ -63,14 +71,20 @@ public Context createNewContext(NewContextForm newContext, UserAccount user) {
6371
@Override
6472
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
6573
public Context updateContext(Context context) {
66-
log.info("updateContext");
67-
return contextRepository.saveAndFlush(context);
74+
log.info("updateContext");
75+
if(context.getUuid()==null){
76+
context.setUuid(UUID.randomUUID());
77+
}
78+
return contextRepository.saveAndFlush(context);
6879
}
6980

7081
@Override
7182
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
7283
public boolean delete(Context context) {
7384
log.info("delete");
85+
if(context.getUuid()==null){
86+
context.setUuid(UUID.randomUUID());
87+
}
7488
long contextId = context.getId();
7589
contextRepository.delete(context);
7690
return (!contextRepository.existsById(contextId));

src/test/java/org/woehlke/java/simpleworklist/SmokeTests.java

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
package org.woehlke.java.simpleworklist;
22

33
import lombok.extern.slf4j.Slf4j;
4+
import org.junit.Ignore;
45
import org.junit.jupiter.api.*;
56
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
68
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
79
import org.springframework.boot.test.context.SpringBootTest;
810
import org.springframework.boot.web.server.LocalServerPort;
911
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
12+
import org.springframework.context.annotation.Configuration;
1013
import org.springframework.context.annotation.Import;
1114
import org.springframework.security.core.context.SecurityContextHolder;
1215
import org.springframework.security.core.userdetails.UsernameNotFoundException;
1316
import org.springframework.security.test.context.support.WithMockUser;
1417
import org.springframework.test.web.servlet.MockMvc;
1518
import org.springframework.test.web.servlet.ResultActions;
1619
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
20+
import org.woehlke.java.simpleworklist.config.SimpleworklistProperties;
1721
import org.woehlke.java.simpleworklist.config.UserAccountTestDataService;
1822

1923
import java.net.URL;
@@ -32,6 +36,9 @@
3236
@AutoConfigureMockMvc
3337
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
3438
@Import(SimpleworklistApplication.class)
39+
@EnableConfigurationProperties({
40+
SimpleworklistProperties.class
41+
})
3542
public class SmokeTests {
3643

3744
@Autowired
@@ -47,7 +54,6 @@ public class SmokeTests {
4754
@Autowired
4855
private UserAccountTestDataService userAccountTestDataService;
4956

50-
5157
private final String eyecatcherH1 = "##################################################################";
5258
private final String eyecatcherH2 = "------------------------------------------------------------------";
5359
private final String eyecatcherH3 = "******************************************************************";
@@ -170,6 +176,7 @@ public void testF007AddFirstNewTaskToInbox(){
170176
log.info(eyecatcherH2);
171177
}
172178

179+
173180
@WithMockUser(username="test01@test.de")
174181
@DisplayName(F008)
175182
@Order(8)
@@ -180,6 +187,7 @@ public void testF008AddAnotherNewTaskToInbox(){
180187
log.info(eyecatcherH2);
181188
}
182189

190+
183191
@WithMockUser(username="test01@test.de")
184192
@DisplayName(F009)
185193
@Order(9)
@@ -190,6 +198,7 @@ public void testF009AddTaskToProjectRoot(){
190198
log.info(eyecatcherH2);
191199
}
192200

201+
193202
@WithMockUser(username="test01@test.de")
194203
@DisplayName(F010)
195204
@Order(10)
@@ -200,6 +209,7 @@ public void testF010AddSubProjectToProjectRoot(){
200209
log.info(eyecatcherH2);
201210
}
202211

212+
203213
@WithMockUser(username="test01@test.de")
204214
@DisplayName(F011)
205215
@Order(11)
@@ -210,6 +220,7 @@ public void testF011SetFocusOfTask(){
210220
log.info(eyecatcherH2);
211221
}
212222

223+
213224
@WithMockUser(username="test01@test.de")
214225
@DisplayName(F012)
215226
@Order(12)
@@ -220,6 +231,7 @@ public void testF012UnSetFocusOfTask(){
220231
log.info(eyecatcherH2);
221232
}
222233

234+
223235
@WithMockUser(username="test01@test.de")
224236
@DisplayName(F013)
225237
@Order(13)
@@ -233,7 +245,7 @@ public void testF013ShowTaskstateInbox() throws Exception {
233245
assertNotNull(this.mockMvc);
234246
try {
235247
this.mockMvc.perform(get(base.toString()))
236-
//.andDo(print())
248+
.andDo(print())
237249
.andExpect(status().isOk());
238250
//.andExpect(content().string(containsString("SimpleWorklist")));
239251
} catch (UsernameNotFoundException e) {
@@ -247,6 +259,7 @@ public void testF013ShowTaskstateInbox() throws Exception {
247259
log.info(eyecatcherH2);
248260
}
249261

262+
250263
@WithMockUser(username="test01@test.de")
251264
@DisplayName(F014)
252265
@Order(14)
@@ -259,12 +272,13 @@ public void testF014ShowTaskstateToday() throws Exception {
259272
log.info("Server URL: "+ base.toString());
260273
assertNotNull(this.mockMvc);
261274
this.mockMvc.perform(get(base.toString()))
262-
//.andDo(print())
275+
.andDo(print())
263276
.andExpect(status().isOk());
264277
//.andExpect(content().string(containsString("SimpleWorklist")));
265278
log.info(eyecatcherH2);
266279
}
267280

281+
268282
@WithMockUser(username="test01@test.de")
269283
@DisplayName(F015)
270284
@Order(15)
@@ -287,6 +301,7 @@ public void testF015ShowTaskstateNext() throws Exception {
287301
log.info(eyecatcherH2);
288302
}
289303

304+
290305
@WithMockUser(username="test01@test.de")
291306
@DisplayName(F016)
292307
@Order(16)
@@ -305,6 +320,7 @@ public void testF016ShowTaskstateWaiting() throws Exception {
305320
log.info(eyecatcherH2);
306321
}
307322

323+
308324
@WithMockUser(username="test01@test.de")
309325
@DisplayName(F017)
310326
@Order(17)
@@ -323,6 +339,7 @@ public void testF017ShowTaskstateScheduled() throws Exception {
323339
log.info(eyecatcherH2);
324340
}
325341

342+
326343
@WithMockUser(username="test01@test.de")
327344
@DisplayName(F018)
328345
@Order(18)
@@ -341,6 +358,7 @@ public void testF018ShowTaskstateSomeday() throws Exception {
341358
log.info(eyecatcherH2);
342359
}
343360

361+
344362
@WithMockUser(username="test01@test.de")
345363
@DisplayName(F019)
346364
@Order(19)
@@ -359,6 +377,7 @@ public void testF019ShowTaskstateFocus() throws Exception {
359377
log.info(eyecatcherH2);
360378
}
361379

380+
362381
@WithMockUser(username="test01@test.de")
363382
@DisplayName(F020)
364383
@Order(20)
@@ -377,6 +396,7 @@ public void testF020ShowTaskstateCompleted() throws Exception {
377396
log.info(eyecatcherH2);
378397
}
379398

399+
380400
@WithMockUser(username="test01@test.de")
381401
@DisplayName(F021)
382402
@Order(21)
@@ -395,6 +415,7 @@ public void testF021ShowTaskstateTrash() throws Exception {
395415
log.info(eyecatcherH2);
396416
}
397417

418+
398419
@WithMockUser(username="test01@test.de")
399420
@DisplayName(F022)
400421
@Order(22)
@@ -405,6 +426,7 @@ public void testF022TaskEdit(){
405426
log.info(eyecatcherH2);
406427
}
407428

429+
408430
@WithMockUser(username="test01@test.de")
409431
@DisplayName(F023)
410432
@Order(23)
@@ -415,6 +437,7 @@ public void testF023TaskEditFormChangeTaskstateViaDropDown(){
415437
log.info(eyecatcherH2);
416438
}
417439

440+
418441
@WithMockUser(username="test01@test.de")
419442
@DisplayName(F024)
420443
@Order(24)
@@ -425,6 +448,7 @@ public void testF024TaskComplete(){
425448
log.info(eyecatcherH2);
426449
}
427450

451+
428452
@WithMockUser(username="test01@test.de")
429453
@DisplayName(F025)
430454
@Order(25)
@@ -435,6 +459,7 @@ public void testF025TaskIncomplete(){
435459
log.info(eyecatcherH2);
436460
}
437461

462+
438463
@WithMockUser(username="test01@test.de")
439464
@DisplayName(F026)
440465
@Order(26)
@@ -445,6 +470,7 @@ public void testF026TaskDelete(){
445470
log.info(eyecatcherH2);
446471
}
447472

473+
448474
@WithMockUser(username="test01@test.de")
449475
@DisplayName(F027)
450476
@Order(27)

src/test/java/org/woehlke/java/simpleworklist/config/UserAccountTestDataServiceImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.woehlke.java.simpleworklist.domain.db.user.account.UserAccountService;
1313

1414
import java.util.Date;
15+
import java.util.UUID;
1516

1617

1718
@Slf4j
@@ -48,6 +49,7 @@ public UserAccountTestDataServiceImpl(
4849
newContext = new NewContextForm[emails.length];
4950
for (int i = 0; i < testUser.length; i++) {
5051
testUser[i] = new UserAccount();
52+
testUser[i].setUuid(UUID.randomUUID());
5153
testUser[i].setUserEmail(emails[i]);
5254
testUser[i].setUserPassword(passwords[i]);
5355
testUser[i].setUserFullname(fullnames[i]);

0 commit comments

Comments
 (0)