Skip to content

Commit 4b0e8ae

Browse files
committed
work
1 parent 9a8cdfb commit 4b0e8ae

File tree

7 files changed

+262
-24
lines changed

7 files changed

+262
-24
lines changed

pom.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,10 +1440,23 @@
14401440
</properties>
14411441
<build>
14421442
<finalName>${project.artifactId}</finalName>
1443-
<defaultGoal>clean dependency:list install</defaultGoal>
1443+
<defaultGoal>clean dependency:list install spring-boot:repackage</defaultGoal>
14441444
</build>
14451445
</profile>
14461446

1447+
<profile>
1448+
<id>testing</id>
1449+
<properties>
1450+
<skipTests>false</skipTests>
1451+
<skip.unit.tests>false</skip.unit.tests>
1452+
<skip.integration.tests>false</skip.integration.tests>
1453+
</properties>
1454+
<build>
1455+
<finalName>${project.artifactId}</finalName>
1456+
<defaultGoal>clean dependency:list install spring-boot:repackage</defaultGoal>
1457+
</build>
1458+
</profile>
1459+
14471460
<profile>
14481461
<id>uml</id>
14491462
<properties>

src/test/java/org/woehlke/java/simpleworklist/domain/UserLoginControllerIT.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.springframework.security.core.context.SecurityContextHolder;
1919
import org.springframework.test.web.servlet.MockMvc;
2020
import org.woehlke.java.simpleworklist.SimpleworklistApplication;
21+
import org.woehlke.java.simpleworklist.application.helper.TestHelperService;
2122
import org.woehlke.java.simpleworklist.config.*;
2223

2324
import java.net.URL;
@@ -35,7 +36,7 @@
3536
@EnableConfigurationProperties({
3637
SimpleworklistProperties.class
3738
})
38-
public class UserLoginControllerIT extends AbstractIntegrationTest {
39+
public class UserLoginControllerIT {
3940

4041

4142
@Autowired
@@ -51,6 +52,9 @@ public class UserLoginControllerIT extends AbstractIntegrationTest {
5152
@Autowired
5253
private UserAccountTestDataService userAccountTestDataService;
5354

55+
@Autowired
56+
protected TestHelperService testHelperService;
57+
5458
private final String eyecatcherH1 = "##################################################################";
5559
private final String eyecatcherH2 = "------------------------------------------------------------------";
5660
private final String eyecatcherH3 = "******************************************************************";
@@ -92,15 +96,24 @@ public void runAfterTestClass() throws Exception {
9296
}
9397

9498

95-
//@Test
99+
@Test
96100
public void testLoginFormular() throws Exception {
97101
this.mockMvc.perform(
98102
get("/user/login")).andDo(print())
99103
.andExpect(view().name(containsString("user/login/loginForm")));
100104
}
101105

102-
//@Test
106+
@Test
103107
public void testFinish() {
104108
deleteAll();
105109
}
110+
111+
112+
protected void deleteAll(){
113+
testHelperService.deleteAllRegistrations();
114+
testHelperService.deleteAllTasks();
115+
testHelperService.deleteAllProjects();
116+
testHelperService.deleteUserAccount();
117+
}
118+
106119
}

src/test/java/org/woehlke/java/simpleworklist/domain/UserPasswordRecoveryControllerIT.java

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@
1212
import org.springframework.security.core.context.SecurityContextHolder;
1313
import org.springframework.test.web.servlet.MockMvc;
1414
import org.woehlke.java.simpleworklist.SimpleworklistApplication;
15+
import org.woehlke.java.simpleworklist.application.helper.TestHelperService;
1516
import org.woehlke.java.simpleworklist.config.*;
1617

1718
import org.springframework.beans.factory.annotation.Autowired;
19+
import org.woehlke.java.simpleworklist.domain.db.user.UserAccount;
1820
import org.woehlke.java.simpleworklist.domain.db.user.UserAccountPasswordRecovery;
1921
import org.woehlke.java.simpleworklist.domain.db.user.passwordrecovery.UserAccountPasswordRecoveryStatus;
2022
import org.woehlke.java.simpleworklist.domain.db.user.passwordrecovery.UserAccountPasswordRecoveryService;
2123

2224
import java.net.URL;
25+
import java.util.UUID;
2326

2427
import static org.hamcrest.Matchers.containsString;
2528
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -42,7 +45,7 @@
4245
@EnableConfigurationProperties({
4346
SimpleworklistProperties.class
4447
})
45-
public class UserPasswordRecoveryControllerIT extends AbstractIntegrationTest {
48+
public class UserPasswordRecoveryControllerIT {
4649

4750
@Autowired
4851
private ServletWebServerApplicationContext server;
@@ -57,10 +60,33 @@ public class UserPasswordRecoveryControllerIT extends AbstractIntegrationTest {
5760
@Autowired
5861
private UserAccountTestDataService userAccountTestDataService;
5962

63+
@Autowired
64+
protected TestHelperService testHelperService;
65+
6066
private final String eyecatcherH1 = "##################################################################";
6167
private final String eyecatcherH2 = "------------------------------------------------------------------";
6268
private final String eyecatcherH3 = "******************************************************************";
6369

70+
protected static String[] emails = {"test01//@Test.de", "test02//@Test.de", "test03//@Test.de"};
71+
protected static String[] passwords = {"test01pwd", "test02pwd", "test03pwd"};
72+
protected static String[] fullnames = {"test01 Name", "test02 Name", "test03 Name"};
73+
74+
protected static String username_email = "undefined//@Test.de";
75+
protected static String password = "ASDFG";
76+
protected static String full_name = "UNDEFINED_NAME";
77+
78+
protected static UserAccount[] testUser = new UserAccount[emails.length];
79+
80+
static {
81+
for (int i = 0; i < testUser.length; i++) {
82+
testUser[i] = new UserAccount();
83+
testUser[i].setUuid(UUID.randomUUID());
84+
testUser[i].setUserEmail(emails[i]);
85+
testUser[i].setUserPassword(passwords[i]);
86+
testUser[i].setUserFullname(fullnames[i]);
87+
}
88+
}
89+
6490
@BeforeEach
6591
public void setUp() throws Exception {
6692
log.info(eyecatcherH1);
@@ -101,21 +127,21 @@ public void runAfterTestClass() throws Exception {
101127
@Autowired
102128
private UserAccountPasswordRecoveryService userAccountPasswordRecoveryService;
103129

104-
//@Test
130+
@Test
105131
public void testResetPassword() throws Exception {
106132
this.mockMvc.perform(
107133
get("/user/resetPassword")).andDo(print())
108134
.andExpect(view().name(containsString("user/resetPassword/resetPasswordForm")));
109135
}
110136

111-
//@Test
137+
@Test
112138
public void testEnterNewPasswordFormular() throws Exception {
113139
this.mockMvc.perform(
114140
get("/user/resetPassword/confirm/ASDF")).andDo(print())
115141
.andExpect(view().name(containsString("user/resetPassword/resetPasswordNotConfirmed")));
116142
}
117143

118-
//@Test
144+
@Test
119145
public void testEnterNewPasswordFormularWithToken() throws Exception {
120146
userAccountPasswordRecoveryService.passwordRecoverySendEmailTo(emails[0]);
121147
try {
@@ -136,8 +162,15 @@ public void testEnterNewPasswordFormularWithToken() throws Exception {
136162
userAccountPasswordRecoveryService.passwordRecoveryDone(o);
137163
}
138164

139-
//@Test
165+
@Test
140166
public void finish(){
141-
super.deleteAll();
167+
deleteAll();
168+
}
169+
170+
protected void deleteAll(){
171+
testHelperService.deleteAllRegistrations();
172+
testHelperService.deleteAllTasks();
173+
testHelperService.deleteAllProjects();
174+
testHelperService.deleteUserAccount();
142175
}
143176
}

src/test/java/org/woehlke/java/simpleworklist/domain/UserRegistrationControllerIT.java

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@
1212
import org.springframework.security.core.context.SecurityContextHolder;
1313
import org.springframework.test.web.servlet.MockMvc;
1414
import org.woehlke.java.simpleworklist.SimpleworklistApplication;
15+
import org.woehlke.java.simpleworklist.application.helper.TestHelperService;
1516
import org.woehlke.java.simpleworklist.config.*;
1617

1718
import org.springframework.beans.factory.annotation.Autowired;
19+
import org.woehlke.java.simpleworklist.domain.db.user.UserAccount;
1820
import org.woehlke.java.simpleworklist.domain.db.user.UserAccountRegistration;
1921
import org.woehlke.java.simpleworklist.domain.db.user.signup.UserAccountRegistrationStatus;
2022
import org.woehlke.java.simpleworklist.domain.db.user.signup.UserAccountRegistrationService;
2123

2224
import java.net.URL;
25+
import java.util.UUID;
2326

2427
import static org.hamcrest.Matchers.containsString;
2528
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -42,7 +45,7 @@
4245
@EnableConfigurationProperties({
4346
SimpleworklistProperties.class
4447
})
45-
public class UserRegistrationControllerIT extends AbstractIntegrationTest {
48+
public class UserRegistrationControllerIT {
4649

4750
@Autowired
4851
private ServletWebServerApplicationContext server;
@@ -57,10 +60,33 @@ public class UserRegistrationControllerIT extends AbstractIntegrationTest {
5760
@Autowired
5861
private UserAccountTestDataService userAccountTestDataService;
5962

63+
@Autowired
64+
protected TestHelperService testHelperService;
65+
6066
private final String eyecatcherH1 = "##################################################################";
6167
private final String eyecatcherH2 = "------------------------------------------------------------------";
6268
private final String eyecatcherH3 = "******************************************************************";
6369

70+
protected static String[] emails = {"test01//@Test.de", "test02//@Test.de", "test03//@Test.de"};
71+
protected static String[] passwords = {"test01pwd", "test02pwd", "test03pwd"};
72+
protected static String[] fullnames = {"test01 Name", "test02 Name", "test03 Name"};
73+
74+
protected static String username_email = "undefined//@Test.de";
75+
protected static String password = "ASDFG";
76+
protected static String full_name = "UNDEFINED_NAME";
77+
78+
protected static UserAccount[] testUser = new UserAccount[emails.length];
79+
80+
static {
81+
for (int i = 0; i < testUser.length; i++) {
82+
testUser[i] = new UserAccount();
83+
testUser[i].setUuid(UUID.randomUUID());
84+
testUser[i].setUserEmail(emails[i]);
85+
testUser[i].setUserPassword(passwords[i]);
86+
testUser[i].setUserFullname(fullnames[i]);
87+
}
88+
}
89+
6490
@BeforeEach
6591
public void setUp() throws Exception {
6692
log.info(eyecatcherH1);
@@ -101,21 +127,21 @@ public void runAfterTestClass() throws Exception {
101127
@Autowired
102128
private UserAccountRegistrationService userAccountRegistrationService;
103129

104-
//@Test
130+
@Test
105131
public void testSignInFormularEmail() throws Exception {
106132
this.mockMvc.perform(
107133
get("/user/register")).andDo(print())
108134
.andExpect(view().name(containsString("user/register/registerForm")));
109135
}
110136

111-
//@Test
137+
@Test
112138
public void testSignInFormularAccount() throws Exception {
113139
this.mockMvc.perform(
114140
get("/user/register/confirm/ASDF")).andDo(print())
115141
.andExpect(view().name(containsString("user/register/registerNotConfirmed")));
116142
}
117143

118-
//@Test
144+
@Test
119145
public void testRegisterNewUserCheckResponseAndRegistrationForm() throws Exception{
120146
userAccountRegistrationService.registrationSendEmailTo(emails[0]);
121147
try {
@@ -136,8 +162,15 @@ public void testRegisterNewUserCheckResponseAndRegistrationForm() throws Excepti
136162
userAccountRegistrationService.registrationUserCreated(o);
137163
}
138164

139-
//@Test
165+
@Test
140166
public void finish(){
141-
super.deleteAll();
167+
deleteAll();
168+
}
169+
170+
protected void deleteAll(){
171+
testHelperService.deleteAllRegistrations();
172+
testHelperService.deleteAllTasks();
173+
testHelperService.deleteAllProjects();
174+
testHelperService.deleteUserAccount();
142175
}
143176
}

src/test/java/org/woehlke/java/simpleworklist/domain/db/user/UserAccountPasswordRecoveryServiceIT.java

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
import org.junit.jupiter.api.Test;
55
import org.springframework.beans.factory.annotation.Autowired;
66
import org.springframework.boot.test.context.SpringBootTest;
7-
import org.woehlke.java.simpleworklist.config.AbstractIntegrationTest;
7+
import org.springframework.boot.web.server.LocalServerPort;
8+
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
9+
import org.springframework.test.web.servlet.MockMvc;
810
import org.woehlke.java.simpleworklist.domain.db.user.passwordrecovery.UserAccountPasswordRecoveryService;
911
import org.woehlke.java.simpleworklist.domain.db.user.passwordrecovery.UserAccountPasswordRecoveryStatus;
1012

13+
import java.util.UUID;
14+
1115
import static org.hamcrest.Matchers.containsString;
1216
import static org.junit.jupiter.api.Assertions.assertNotNull;
1317
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -18,11 +22,42 @@
1822

1923
@Slf4j
2024
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
21-
public class UserAccountPasswordRecoveryServiceIT extends AbstractIntegrationTest {
25+
public class UserAccountPasswordRecoveryServiceIT {
26+
27+
@Autowired
28+
private ServletWebServerApplicationContext server;
29+
30+
@Autowired
31+
private MockMvc mockMvc;
32+
33+
@SuppressWarnings("deprecation")
34+
@LocalServerPort
35+
private int port;
2236

2337
@Autowired
2438
private UserAccountPasswordRecoveryService userAccountPasswordRecoveryService;
2539

40+
41+
protected static String[] emails = {"test01//@Test.de", "test02//@Test.de", "test03//@Test.de"};
42+
protected static String[] passwords = {"test01pwd", "test02pwd", "test03pwd"};
43+
protected static String[] fullnames = {"test01 Name", "test02 Name", "test03 Name"};
44+
45+
protected static String username_email = "undefined//@Test.de";
46+
protected static String password = "ASDFG";
47+
protected static String full_name = "UNDEFINED_NAME";
48+
49+
protected static UserAccount[] testUser = new UserAccount[emails.length];
50+
51+
static {
52+
for (int i = 0; i < testUser.length; i++) {
53+
testUser[i] = new UserAccount();
54+
testUser[i].setUuid(UUID.randomUUID());
55+
testUser[i].setUserEmail(emails[i]);
56+
testUser[i].setUserPassword(passwords[i]);
57+
testUser[i].setUserFullname(fullnames[i]);
58+
}
59+
}
60+
2661
@Test
2762
public void testResetPassword() throws Exception {
2863
this.mockMvc.perform(
@@ -59,7 +94,15 @@ public void testEnterNewPasswordFormularWithToken() throws Exception {
5994
}
6095

6196
@Test
62-
public void finish(){
63-
super.deleteAll();
97+
public void finish(){ deleteAll();
98+
}
99+
100+
101+
102+
protected void deleteAll(){
103+
testHelperService.deleteAllRegistrations();
104+
testHelperService.deleteAllTasks();
105+
testHelperService.deleteAllProjects();
106+
testHelperService.deleteUserAccount();
64107
}
65108
}

0 commit comments

Comments
 (0)