+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/java/org/woehlke/simpleworklist/SmokeTests.java b/src/test/java/org/woehlke/simpleworklist/SmokeTests.java
new file mode 100644
index 00000000..27791493
--- /dev/null
+++ b/src/test/java/org/woehlke/simpleworklist/SmokeTests.java
@@ -0,0 +1,195 @@
+package org.woehlke.simpleworklist;
+
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.test.context.event.annotation.AfterTestClass;
+import org.springframework.test.context.event.annotation.BeforeTestClass;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.web.context.WebApplicationContext;
+import org.woehlke.simpleworklist.config.UserAccountTestDataService;
+
+import java.net.URL;
+
+import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
+
+@Slf4j
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
+public class SmokeTests {
+
+ @Autowired
+ ServletWebServerApplicationContext server;
+
+ @LocalServerPort
+ int port;
+
+ protected URL base;
+
+ @Autowired
+ protected WebApplicationContext wac;
+
+ protected MockMvc mockMvc;
+
+ @Autowired
+ private UserAccountTestDataService userAccountTestDataService;
+
+ @BeforeEach
+ public void setUp() throws Exception {
+ log.info(" @BeforeEach setUp()");
+ this.base = new URL("http://localhost:" + port + "/");
+ this.mockMvc = webAppContextSetup(wac).build();
+ userAccountTestDataService.setUp();
+ }
+
+ @BeforeTestClass
+ public void runBeforeTestClass() throws Exception {
+ log.info(" @BeforeTestClass runBeforeTestClass");
+ }
+
+ @AfterTestClass
+ public void runAfterTestClass() {
+ log.info(" @AfterTestClass clearContext");
+ SecurityContextHolder.clearContext();
+ }
+
+ @Test
+ public void testF001ServerStarts(){
+ log.info("testF001ServerStarts");
+ }
+
+ @Test
+ public void testF002HomePageRendered(){
+ log.info("testF002HomePageRendered");
+ }
+
+ @Test
+ public void testF003Registration(){
+ log.info("testF003Registration");
+ }
+
+ @Test
+ public void testF004PasswordRecovery(){
+ log.info("testF004PasswordRecovery");
+ }
+
+ @Test
+ public void testF005Login(){
+ log.info("testF005Login");
+ }
+
+ @Test
+ public void testF006PageAfterFirstSuccessfulLogin(){
+ log.info("testF006PageAfterFirstSuccessfulLogins");
+ }
+
+ @Test
+ public void testF007AddFirstNewTaskToInbox(){
+ log.info("testF007AddFirstNewTaskToInbox");
+ }
+
+ @Test
+ public void testF008AddAnotherNewTaskToInbox(){
+ log.info("testF008AddAnotherNewTaskToInbox");
+ }
+
+ @Test
+ public void testF009AddTaskToProjectRoot(){
+ log.info("testF009AddTaskToProjectRoot");
+ }
+ @Test
+ public void testF010AddSubProjectToProjectRoot(){
+ log.info("testF010AddSubProjectToProjectRoot");
+ }
+
+ @Test
+ public void testF011SetFocusOfTask(){
+ log.info("testF011SetFocusOfTask");
+ }
+
+ @Test
+ public void testF012UnSetFocusOfTask(){
+ log.info("testF012UnSetFocusOfTask");
+ }
+
+ @Test
+ public void testF013ShowTaskstateInbox(){
+ log.info("testF013ShowTaskstateInbox");
+ }
+
+ @Test
+ public void testF014ShowTaskstateToday(){
+ log.info("testF014ShowTaskstateToday");
+ }
+
+ @Test
+ public void testF015ShowTaskstateNext(){
+ log.info("testF015ShowTaskstateNext");
+ }
+
+ @Test
+ public void testF016ShowTaskstateWaiting(){
+ log.info("testF016ShowTaskstateWaiting");
+ }
+
+ @Test
+ public void testF017ShowTaskstateScheduled(){
+ log.info("testF017ShowTaskstateScheduled");
+ }
+
+ @Test
+ public void testF018ShowTaskstateSomeday(){
+ log.info("testF018ShowTaskstateSomeday");
+ }
+
+ @Test
+ public void testF019ShowTaskstateFocus(){
+ log.info("testF019ShowTaskstateFocus");
+ }
+
+ @Test
+ public void testF020ShowTaskstateCompleted(){
+ log.info("testF020ShowTaskstateCompleted");
+ }
+
+ @Test
+ public void testF021ShowTaskstateTrash(){
+ log.info("testF021ShowTaskstateTrash");
+ }
+
+ @Test
+ public void testF022TaskEdit(){
+ log.info("testF022TaskEdit");
+ }
+
+ @Test
+ public void testF023TaskEditFormChangeTaskstateViaDropDown(){
+ log.info("testF023TaskEditFormChangeTaskstateViaDropDown");
+ }
+
+ @Test
+ public void testF024TaskComplete(){
+ log.info("testF024TaskComplete");
+ }
+
+ @Test
+ public void testF025TaskIncomplete(){
+ log.info("testF025TaskIncomplete");
+ }
+
+ @Test
+ public void testF026TaskDelete(){
+ log.info("testF026TaskDelete");
+ }
+
+ @Test
+ public void testF027TaskUndelete(){
+ log.info("testF027TaskUndelete");
+ }
+
+
+}
diff --git a/src/test/java/org/woehlke/simpleworklist/AbstractTest.java b/src/test/java/org/woehlke/simpleworklist/config/AbstractTest.java
similarity index 71%
rename from src/test/java/org/woehlke/simpleworklist/AbstractTest.java
rename to src/test/java/org/woehlke/simpleworklist/config/AbstractTest.java
index 609bb70a..e737d1e2 100644
--- a/src/test/java/org/woehlke/simpleworklist/AbstractTest.java
+++ b/src/test/java/org/woehlke/simpleworklist/config/AbstractTest.java
@@ -1,16 +1,16 @@
-package org.woehlke.simpleworklist;
+package org.woehlke.simpleworklist.config;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.BeforeEach;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.context.event.annotation.AfterTestClass;
+import org.springframework.test.context.event.annotation.BeforeTestClass;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.context.WebApplicationContext;
import org.woehlke.simpleworklist.config.ApplicationProperties;
@@ -22,46 +22,59 @@
import org.woehlke.simpleworklist.user.login.UserAccountLoginSuccessService;
+import java.net.URL;
+
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
-@WebAppConfiguration
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes={SimpleworklistApplication.class})
public abstract class AbstractTest {
- @Autowired
- protected WebApplicationContext wac;
+ //@LocalServerPort
+ protected int port;
- protected MockMvc mockMvc;
+ protected URL base;
- @Autowired
+ //@Autowired
protected ApplicationProperties applicationProperties;
- @Autowired
- protected TestHelperService testHelperService;
+ //@Autowired
+ protected WebApplicationContext wac;
- @Autowired
- protected UserAccountService userAccountService;
+ protected MockMvc mockMvc;
- @Autowired
- protected UserAccountSecurityService userAccountSecurityService;
+ // //@BeforeEach
+ public void setUp() throws Exception {
+ //log.info(" //@BeforeEach ");
+ this.base = new URL("http://localhost:" + port + "/");
+ this.mockMvc = webAppContextSetup(wac).build();
+ for (UserAccount u : testUser) {
+ UserAccount a = userAccountService.findByUserEmail(u.getUserEmail());
+ if (a == null) {
+ userAccountService.saveAndFlush(u);
+ }
+ }
+ }
- @Autowired
- protected UserAccountAccessService userAccountAccessService;
+ //@BeforeTestClass
+ public void setupClass() throws Exception {
+ //log.info(" //@BeforeTestClass ");
+ }
- @Autowired
- protected UserAccountLoginSuccessService userAccountLoginSuccessService;
+ //@AfterTestClass
+ public void clearContext() {
+ // log.info(" //@AfterTestClass ");
+ SecurityContextHolder.clearContext();
+ }
- protected static String emails[] = {"test01@test.de", "test02@test.de", "test03@test.de"};
- protected static String passwords[] = {"test01pwd", "test02pwd", "test03pwd"};
- protected static String fullnames[] = {"test01 Name", "test02 Name", "test03 Name"};
+ protected static String[] emails = {"test01//@Test.de", "test02//@Test.de", "test03//@Test.de"};
+ protected static String[] passwords = {"test01pwd", "test02pwd", "test03pwd"};
+ protected static String[] fullnames = {"test01 Name", "test02 Name", "test03 Name"};
- protected static String username_email = "undefined@test.de";
+ protected static String username_email = "undefined//@Test.de";
protected static String password = "ASDFG";
protected static String full_name = "UNDEFINED_NAME";
- protected static UserAccount testUser[] = new UserAccount[emails.length];
+ protected static UserAccount[] testUser = new UserAccount[emails.length];
static {
for (int i = 0; i < testUser.length; i++) {
@@ -85,19 +98,19 @@ protected void deleteAll(){
testHelperService.deleteUserAccount();
}
- @Before
- public void setup() throws Exception {
- this.mockMvc = webAppContextSetup(wac).build();
- for (UserAccount u : testUser) {
- UserAccount a = userAccountService.findByUserEmail(u.getUserEmail());
- if (a == null) {
- userAccountService.saveAndFlush(u);
- }
- }
- }
+ @Autowired
+ protected TestHelperService testHelperService;
+
+ @Autowired
+ protected UserAccountService userAccountService;
+
+ @Autowired
+ protected UserAccountSecurityService userAccountSecurityService;
+
+ @Autowired
+ protected UserAccountAccessService userAccountAccessService;
+
+ @Autowired
+ protected UserAccountLoginSuccessService userAccountLoginSuccessService;
- @After
- public void clearContext() {
- SecurityContextHolder.clearContext();
- }
}
diff --git a/src/test/java/org/woehlke/simpleworklist/config/UserAccountTestDataService.java b/src/test/java/org/woehlke/simpleworklist/config/UserAccountTestDataService.java
new file mode 100644
index 00000000..7e988b41
--- /dev/null
+++ b/src/test/java/org/woehlke/simpleworklist/config/UserAccountTestDataService.java
@@ -0,0 +1,11 @@
+package org.woehlke.simpleworklist.config;
+
+import org.woehlke.simpleworklist.user.account.UserAccount;
+
+public interface UserAccountTestDataService {
+
+ void setUp();
+
+ UserAccount getFirstUserAccount();
+
+}
diff --git a/src/test/java/org/woehlke/simpleworklist/config/UserAccountTestDataServiceImpl.java b/src/test/java/org/woehlke/simpleworklist/config/UserAccountTestDataServiceImpl.java
new file mode 100644
index 00000000..05388059
--- /dev/null
+++ b/src/test/java/org/woehlke/simpleworklist/config/UserAccountTestDataServiceImpl.java
@@ -0,0 +1,79 @@
+package org.woehlke.simpleworklist.config;
+
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.woehlke.simpleworklist.context.Context;
+import org.woehlke.simpleworklist.context.ContextService;
+import org.woehlke.simpleworklist.context.NewContextForm;
+import org.woehlke.simpleworklist.language.Language;
+import org.woehlke.simpleworklist.user.account.UserAccount;
+import org.woehlke.simpleworklist.user.account.UserAccountService;
+
+import java.util.Date;
+
+
+@Slf4j
+@Getter
+@Service
+public class UserAccountTestDataServiceImpl implements UserAccountTestDataService {
+
+ private final String[] emails = { "test01@test.de", "test02@test.de", "test03@test.de" };
+ private final String[] passwords = { "test01pwd", "test02pwd", "test03pwd"};
+ private final String[] fullnames = { "test01 Name", "test02 Name", "test03 Name"};
+
+ private final String username_email = "undefined@test.de";
+ private final String password = "ASDFG";
+ private final String full_name = "UNDEFINED_NAME";
+
+ private final UserAccount[] testUser;
+ private final NewContextForm[] newContext;
+
+ private final UserAccountService userAccountService;
+ private final ContextService contextService;
+ private final ApplicationProperties applicationProperties;
+
+ @Autowired
+ public UserAccountTestDataServiceImpl(
+ UserAccountService userAccountService,
+ ContextService contextService,
+ ApplicationProperties applicationProperties
+ ) {
+ this.userAccountService = userAccountService;
+ this.contextService = contextService;
+ this.applicationProperties = applicationProperties;
+ Date lastLoginTimestamp = new Date();
+ testUser = new UserAccount[emails.length];
+ newContext = new NewContextForm[emails.length];
+ for (int i = 0; i < testUser.length; i++) {
+ testUser[i] = new UserAccount();
+ testUser[i].setUserEmail(emails[i]);
+ testUser[i].setUserPassword(passwords[i]);
+ testUser[i].setUserFullname(fullnames[i]);
+ testUser[i].setDefaultLanguage(Language.EN);
+ testUser[i].setLastLoginTimestamp(lastLoginTimestamp);
+ newContext[i] = new NewContextForm("testDe_"+i,"testEn_"+i);
+ }
+ }
+
+ public void setUp() {
+ for (int i = 0; i < testUser.length; i++) {
+ UserAccount a = userAccountService.findByUserEmail(testUser[i].getUserEmail());
+ if (a == null) {
+ UserAccount persisted = userAccountService.saveAndFlush(testUser[i]);
+ testUser[i] = persisted;
+ NewContextForm newContextPrivate = new NewContextForm("privat"+i,"private"+i);
+ NewContextForm newContextWork = new NewContextForm("arbeit"+i,"work"+i);
+ Context persistedContextPrivate = contextService.createNewContext(newContextPrivate, testUser[i]);
+ Context persistedContextWork = contextService.createNewContext(newContextWork, testUser[i]);
+ testUser[i].setDefaultContext(persistedContextPrivate);
+ }
+ }
+ }
+
+ @Override
+ public UserAccount getFirstUserAccount() {
+ return testUser[0];
+ }
+}
diff --git a/src/test/java/org/woehlke/simpleworklist/testdata/TestDataServiceTest.java b/src/test/java/org/woehlke/simpleworklist/testdata/TestDataServiceTest.java
index 612a5c50..f8586813 100644
--- a/src/test/java/org/woehlke/simpleworklist/testdata/TestDataServiceTest.java
+++ b/src/test/java/org/woehlke/simpleworklist/testdata/TestDataServiceTest.java
@@ -1,4 +1,58 @@
package org.woehlke.simpleworklist.testdata;
+import lombok.extern.slf4j.Slf4j;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.web.context.WebApplicationContext;
+import org.woehlke.simpleworklist.config.UserAccountTestDataService;
+import org.woehlke.simpleworklist.user.account.UserAccount;
+
+import java.net.URL;
+
+import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
+
+@Slf4j
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class TestDataServiceTest {
+
+ @Autowired
+ ServletWebServerApplicationContext server;
+
+ @LocalServerPort
+ int port;
+
+ protected URL base;
+
+ @Autowired
+ protected WebApplicationContext wac;
+
+ protected MockMvc mockMvc;
+
+ @Autowired
+ private TestDataService testDataService;
+
+ @Autowired
+ private UserAccountTestDataService userAccountTestDataService;
+
+ @BeforeEach
+ public void setUp() throws Exception {
+ log.info(" @BeforeEach setUp()");
+ this.base = new URL("http://localhost:" + port + "/");
+ this.mockMvc = webAppContextSetup(wac).build();
+ }
+
+ @Test
+ public void createTestCategoryTreeForUserAccountTest(){
+ log.info("createTestCategoryTreeForUserAccountTest");
+ userAccountTestDataService.setUp();
+ UserAccount userAccount = userAccountTestDataService.getFirstUserAccount();
+ //TODO: #128
+ //testDataService.createTestCategoryTreeForUserAccount(userAccount);
+ }
}
diff --git a/src/test/java/org/woehlke/simpleworklist/user/UserDetailsBeanTest.java b/src/test/java/org/woehlke/simpleworklist/user/UserDetailsBeanTest.java
index 66073f87..28d60a9c 100644
--- a/src/test/java/org/woehlke/simpleworklist/user/UserDetailsBeanTest.java
+++ b/src/test/java/org/woehlke/simpleworklist/user/UserDetailsBeanTest.java
@@ -1,39 +1,40 @@
package org.woehlke.simpleworklist.user;
-import org.junit.Assert;
-import org.junit.Test;
+
+import org.junit.jupiter.api.Test;
import org.springframework.security.core.GrantedAuthority;
import org.woehlke.simpleworklist.user.account.UserAccount;
-import org.woehlke.simpleworklist.user.UserDetailsBean;
import java.util.Collection;
+import static org.junit.jupiter.api.Assertions.*;
+
public class UserDetailsBeanTest {
- @Test
+ //@Test
public void testGetAuthorities(){
UserAccount account = new UserAccount();
UserDetailsBean b = new UserDetailsBean(account);
Collection extends GrantedAuthority> c = b.getAuthorities();
- Assert.assertTrue(c.size()==1);
+ assertTrue(c.size()==1);
for(GrantedAuthority authority:c){
- Assert.assertTrue(authority.getAuthority().compareTo("ROLE_USER")==0);
+ assertTrue(authority.getAuthority().compareTo("ROLE_USER")==0);
}
}
- @Test
+ //@Test
public void testDefaultBooleans(){
UserAccount account = new UserAccount();
UserDetailsBean b = new UserDetailsBean(account);
- Assert.assertTrue(b.isAccountNonExpired());
- Assert.assertTrue(b.isAccountNonLocked());
- Assert.assertTrue(b.isCredentialsNonExpired());
- Assert.assertTrue(b.isEnabled());
+ assertTrue(b.isAccountNonExpired());
+ assertTrue(b.isAccountNonLocked());
+ assertTrue(b.isCredentialsNonExpired());
+ assertTrue(b.isEnabled());
}
- @Test
+ //@Test
public void testHashCodeAndEquals(){
UserAccount account1 = new UserAccount();
UserAccount account2 = new UserAccount();
@@ -45,16 +46,16 @@ public void testHashCodeAndEquals(){
UserAccount account8 = new UserAccount();
UserAccount account9 = new UserAccount();
- account1.setUserEmail("test01@test.de");
+ account1.setUserEmail("test01//@Test.de");
account1.setUserPassword("pwd01");
- account2.setUserEmail("test01@test.de");
+ account2.setUserEmail("test01//@Test.de");
account2.setUserPassword("pwd01");
- account3.setUserEmail("test03@test.de");
+ account3.setUserEmail("test03//@Test.de");
account3.setUserPassword("pwd03");
- account4.setUserEmail("test01@test.de");
+ account4.setUserEmail("test01//@Test.de");
account4.setUserPassword("pwd03");
account5.setUserEmail(null);
@@ -63,13 +64,13 @@ public void testHashCodeAndEquals(){
account6.setUserEmail(null);
account6.setUserPassword("PWD_NOT_NULL_01");
- account7.setUserEmail("test03@test.de");
+ account7.setUserEmail("test03//@Test.de");
account7.setUserPassword(null);
account8.setUserEmail(null);
account8.setUserPassword("PWD_NOT_NULL_02");
- account9.setUserEmail("test04@test.de");
+ account9.setUserEmail("test04//@Test.de");
account9.setUserPassword(null);
UserDetailsBean b1 = new UserDetailsBean(account1);
@@ -82,34 +83,34 @@ public void testHashCodeAndEquals(){
UserDetailsBean b8 = new UserDetailsBean(account8);
UserDetailsBean b9 = new UserDetailsBean(account9);
- Assert.assertEquals(b1.hashCode(),b2.hashCode());
- Assert.assertTrue(b1.hashCode()!=b3.hashCode());
- Assert.assertTrue(b1.hashCode()!=b4.hashCode());
- Assert.assertTrue(b1.hashCode()!=b5.hashCode());
- Assert.assertTrue(b1.hashCode()!=b6.hashCode());
- Assert.assertTrue(b1.hashCode()!=b7.hashCode());
- Assert.assertTrue(b1.hashCode()!=b8.hashCode());
- Assert.assertTrue(b1.hashCode()!=b9.hashCode());
-
- Assert.assertTrue(b1.equals(b1));
- Assert.assertTrue(b1.equals(b2));
-
- Assert.assertFalse(b1.equals(null));
- Assert.assertFalse(b1.equals(account1));
- Assert.assertFalse(b1.equals(b3));
- Assert.assertFalse(b1.equals(b4));
- Assert.assertFalse(b1.equals(b5));
- Assert.assertFalse(b1.equals(b6));
- Assert.assertFalse(b1.equals(b7));
- Assert.assertFalse(b1.equals(b8));
- Assert.assertFalse(b1.equals(b9));
-
- Assert.assertFalse(b3.equals(b1));
- Assert.assertFalse(b4.equals(b1));
- Assert.assertFalse(b5.equals(b1));
- Assert.assertFalse(b6.equals(b1));
- Assert.assertFalse(b7.equals(b1));
- Assert.assertFalse(b8.equals(b1));
- Assert.assertFalse(b9.equals(b1));
+ assertEquals(b1.hashCode(),b2.hashCode());
+ assertTrue(b1.hashCode()!=b3.hashCode());
+ assertTrue(b1.hashCode()!=b4.hashCode());
+ assertTrue(b1.hashCode()!=b5.hashCode());
+ assertTrue(b1.hashCode()!=b6.hashCode());
+ assertTrue(b1.hashCode()!=b7.hashCode());
+ assertTrue(b1.hashCode()!=b8.hashCode());
+ assertTrue(b1.hashCode()!=b9.hashCode());
+
+ assertTrue(b1.equals(b1));
+ assertTrue(b1.equals(b2));
+
+ assertFalse(b1.equals(null));
+ assertFalse(b1.equals(account1));
+ assertFalse(b1.equals(b3));
+ assertFalse(b1.equals(b4));
+ assertFalse(b1.equals(b5));
+ assertFalse(b1.equals(b6));
+ assertFalse(b1.equals(b7));
+ assertFalse(b1.equals(b8));
+ assertFalse(b1.equals(b9));
+
+ assertFalse(b3.equals(b1));
+ assertFalse(b4.equals(b1));
+ assertFalse(b5.equals(b1));
+ assertFalse(b6.equals(b1));
+ assertFalse(b7.equals(b1));
+ assertFalse(b8.equals(b1));
+ assertFalse(b9.equals(b1));
}
}
diff --git a/src/test/java/org/woehlke/simpleworklist/user/account/UserAccountFormTest.java b/src/test/java/org/woehlke/simpleworklist/user/account/UserAccountPasswordEncodedTest.java
similarity index 54%
rename from src/test/java/org/woehlke/simpleworklist/user/account/UserAccountFormTest.java
rename to src/test/java/org/woehlke/simpleworklist/user/account/UserAccountPasswordEncodedTest.java
index a0e03039..a88bde8b 100644
--- a/src/test/java/org/woehlke/simpleworklist/user/account/UserAccountFormTest.java
+++ b/src/test/java/org/woehlke/simpleworklist/user/account/UserAccountPasswordEncodedTest.java
@@ -1,42 +1,48 @@
package org.woehlke.simpleworklist.user.account;
-import org.junit.Assert;
-import org.junit.Test;
-import org.woehlke.simpleworklist.AbstractTest;
+
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.woehlke.simpleworklist.config.AbstractTest;
import org.springframework.beans.factory.annotation.Autowired;
-import org.woehlke.simpleworklist.user.account.UserAccountForm;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-public class UserAccountFormTest extends AbstractTest {
+public class UserAccountPasswordEncodedTest extends AbstractTest {
@Autowired
- private org.springframework.security.crypto.password.PasswordEncoder encoder;
+ private PasswordEncoder encoder;
+
+ //@Test
+ public void testEncoderIsWired(){
+ assertTrue(encoder != null);
+ }
/**
* This Test is obsolete now due to changed encoder from MD5 to BCrypt (20.02.2016).
*/
- @Test
+ //@Test
public void testGetUserPasswordEncoded(){
UserAccountForm u = new UserAccountForm();
- u.setUserEmail("test01@test.de");
+ u.setUserEmail("test01//@Test.de");
u.setUserFullname("some_name");
u.setUserPassword("pwd01_ASDFGHJKLMOP_22");
u.setUserPasswordConfirmation("pwd01_ASDFGHJKLMOP_22");
String encodedPassword = encoder.encode(u.getUserPassword());
- Assert.assertTrue(encodedPassword.compareTo(encoder.encode(u.getUserPassword()))==0);
+ assertTrue(encodedPassword.compareTo(encoder.encode(u.getUserPassword()))==0);
}
- @Test
+ //@Test
public void testPasswordsAreTheSame(){
UserAccountForm u = new UserAccountForm();
- u.setUserEmail("test01@test.de");
+ u.setUserEmail("test01//@Test.de");
u.setUserFullname("some_name");
u.setUserPassword("pwd01_ASDFGHJKLMOP_22");
u.setUserPasswordConfirmation("pwd01_ASDFGHJKLMOP_22");
- Assert.assertTrue(u.passwordsAreTheSame());
+ assertTrue(u.passwordsAreTheSame());
u.setUserPasswordConfirmation("pwd01_ASDFGHJKLMOP_23");
- Assert.assertFalse(u.passwordsAreTheSame());
+ assertFalse(u.passwordsAreTheSame());
}
}
diff --git a/src/test/java/org/woehlke/simpleworklist/user/account/UserAccountServiceImplTest.java b/src/test/java/org/woehlke/simpleworklist/user/account/UserAccountServiceImplTest.java
index 1137a7a4..611f4478 100644
--- a/src/test/java/org/woehlke/simpleworklist/user/account/UserAccountServiceImplTest.java
+++ b/src/test/java/org/woehlke/simpleworklist/user/account/UserAccountServiceImplTest.java
@@ -2,20 +2,18 @@
import org.springframework.beans.factory.annotation.Autowired;
-import org.junit.Assert;
-import org.junit.Test;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.woehlke.simpleworklist.AbstractTest;
+import org.woehlke.simpleworklist.config.AbstractTest;
import org.woehlke.simpleworklist.user.resetpassword.UserPasswordRecoveryService;
import org.woehlke.simpleworklist.user.register.UserRegistrationService;
import org.woehlke.simpleworklist.user.login.LoginForm;
-import org.woehlke.simpleworklist.user.account.UserAccountForm;
-import org.woehlke.simpleworklist.user.account.UserAccount;
+
+import static org.junit.jupiter.api.Assertions.*;
public class UserAccountServiceImplTest extends AbstractTest {
@@ -26,63 +24,63 @@ public class UserAccountServiceImplTest extends AbstractTest {
@Autowired
private UserPasswordRecoveryService userPasswordRecoveryService;
- @Test
+ //@Test
public void testStartSecondOptIn() throws Exception {
int zeroNumberOfAllRegistrations = 0;
deleteAll();
String email = applicationProperties.getRegistration().getMailFrom();
- Assert.assertEquals(zeroNumberOfAllRegistrations, testHelperService.getNumberOfAllRegistrations());
- Assert.assertNotNull(email);
- Assert.assertTrue(userAccountService.isEmailAvailable(email));
+ assertEquals(zeroNumberOfAllRegistrations, testHelperService.getNumberOfAllRegistrations());
+ assertNotNull(email);
+ assertTrue(userAccountService.isEmailAvailable(email));
registrationService.registrationSendEmailTo(email);
- Assert.assertFalse(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
- Assert.assertTrue(userAccountService.isEmailAvailable(email));
+ assertFalse(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
+ assertTrue(userAccountService.isEmailAvailable(email));
registrationService.registrationSendEmailTo(email);
- Assert.assertFalse(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
+ assertFalse(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
registrationService.registrationSendEmailTo(email);
- Assert.assertFalse(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
+ assertFalse(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
registrationService.registrationSendEmailTo(email);
- Assert.assertFalse(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
+ assertFalse(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
registrationService.registrationSendEmailTo(email);
- Assert.assertFalse(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
+ assertFalse(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
registrationService.registrationSendEmailTo(email);
- Assert.assertTrue(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
+ assertTrue(registrationService.registrationIsRetryAndMaximumNumberOfRetries(email));
int sixSeconds = 6000;
Thread.sleep(sixSeconds);
deleteAll();
- Assert.assertEquals(zeroNumberOfAllRegistrations, testHelperService.getNumberOfAllRegistrations());
+ assertEquals(zeroNumberOfAllRegistrations, testHelperService.getNumberOfAllRegistrations());
}
- @Test
+ //@Test
public void testPasswordResetSendEmail() throws Exception {
deleteAll();
for(UserAccount userAccount:testUser){
userAccountService.saveAndFlush(userAccount);
}
int zeroNumberOfAllRegistrations = 0;
- Assert.assertEquals(zeroNumberOfAllRegistrations, testHelperService.getNumberOfAllRegistrations());
- Assert.assertNotNull(emails[0]);
- Assert.assertFalse(userAccountService.isEmailAvailable(emails[0]));
+ assertEquals(zeroNumberOfAllRegistrations, testHelperService.getNumberOfAllRegistrations());
+ assertNotNull(emails[0]);
+ assertFalse(userAccountService.isEmailAvailable(emails[0]));
userPasswordRecoveryService.passwordRecoverySendEmailTo(emails[0]);
- Assert.assertFalse(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
- Assert.assertFalse(userAccountService.isEmailAvailable(emails[0]));
+ assertFalse(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
+ assertFalse(userAccountService.isEmailAvailable(emails[0]));
userPasswordRecoveryService.passwordRecoverySendEmailTo(emails[0]);
- Assert.assertFalse(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
+ assertFalse(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
userPasswordRecoveryService.passwordRecoverySendEmailTo(emails[0]);
- Assert.assertFalse(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
+ assertFalse(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
userPasswordRecoveryService.passwordRecoverySendEmailTo(emails[0]);
- Assert.assertFalse(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
+ assertFalse(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
userPasswordRecoveryService.passwordRecoverySendEmailTo(emails[0]);
- Assert.assertFalse(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
+ assertFalse(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
userPasswordRecoveryService.passwordRecoverySendEmailTo(emails[0]);
- Assert.assertTrue(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
+ assertTrue(userPasswordRecoveryService.passwordRecoveryIsRetryAndMaximumNumberOfRetries(emails[0]));
int sixSeconds = 6000;
Thread.sleep(sixSeconds);
deleteAll();
- Assert.assertEquals(zeroNumberOfAllRegistrations, testHelperService.getNumberOfAllRegistrations());
+ assertEquals(zeroNumberOfAllRegistrations, testHelperService.getNumberOfAllRegistrations());
}
- @Test
+ //@Test
public void testSaveAndFlush(){
deleteAll();
for(UserAccount userAccount:testUser){
@@ -90,51 +88,51 @@ public void testSaveAndFlush(){
}
for(String email:emails){
UserAccount user = userAccountService.findByUserEmail(email);
- Assert.assertTrue(user.getUserEmail().compareTo(email) == 0);
+ assertTrue(user.getUserEmail().compareTo(email) == 0);
}
Pageable request = PageRequest.of(0,10);
for(UserAccount user: userAccountService.findAll(request)){
- Assert.assertNotNull(user.getId());
- Assert.assertNotNull(user.getUserEmail());
- Assert.assertNotNull(user.getUserPassword());
- Assert.assertNotNull(user.getUserFullname());
- Assert.assertNotNull(user.getRowCreatedAt());
+ assertNotNull(user.getId());
+ assertNotNull(user.getUserEmail());
+ assertNotNull(user.getUserPassword());
+ assertNotNull(user.getUserFullname());
+ assertNotNull(user.getRowCreatedAt());
}
}
- @Test
+ //@Test
public void testLoadUserByUsername(){
for(String email:emails){
UserDetails userDetails = userAccountSecurityService.loadUserByUsername(email);
- Assert.assertTrue(userDetails.getUsername().compareTo(email) == 0);
+ assertTrue(userDetails.getUsername().compareTo(email) == 0);
}
try {
UserDetails userDetails = userAccountSecurityService.loadUserByUsername(username_email);
} catch (UsernameNotFoundException e){
- Assert.assertNotNull(e.getMessage());
- Assert.assertTrue(username_email.compareTo(e.getMessage())==0);
+ assertNotNull(e.getMessage());
+ assertTrue(username_email.compareTo(e.getMessage())==0);
}
}
- @Test
+ //@Test
public void testAuthorize(){
LoginForm loginForm = new LoginForm();
loginForm.setUserEmail(emails[0]);
loginForm.setUserPassword(passwords[0]);
- Assert.assertTrue(userAccountAccessService.authorize(loginForm));
+ assertTrue(userAccountAccessService.authorize(loginForm));
loginForm = new LoginForm();
loginForm.setUserEmail(username_email);
loginForm.setUserPassword(password);
- Assert.assertFalse(userAccountAccessService.authorize(loginForm));
+ assertFalse(userAccountAccessService.authorize(loginForm));
}
- @Test
+ //@Test
public void testIsEmailAvailable() {
- Assert.assertFalse(userAccountService.isEmailAvailable(emails[0]));
- Assert.assertTrue(userAccountService.isEmailAvailable(username_email));
+ assertFalse(userAccountService.isEmailAvailable(emails[0]));
+ assertTrue(userAccountService.isEmailAvailable(username_email));
}
- @Test
+ //@Test
public void testCreateUser() {
UserAccountForm userAccount = new UserAccountForm();
userAccount.setUserEmail(username_email);
@@ -142,10 +140,10 @@ public void testCreateUser() {
userAccount.setUserPasswordConfirmation(password);
userAccount.setUserFullname(full_name);
userAccountService.createUser(userAccount);
- Assert.assertFalse(userAccountService.isEmailAvailable(username_email));
+ assertFalse(userAccountService.isEmailAvailable(username_email));
}
- @Test
+ //@Test
public void testChangeUsersPassword(){
UserAccountForm userAccount = new UserAccountForm();
userAccount.setUserEmail(emails[0]);
@@ -155,32 +153,33 @@ public void testChangeUsersPassword(){
userAccountService.changeUsersPassword(userAccount);
}
- @Test
+ //@Test
public void testRetrieveUsernameLoggedOut(){
String userName = userAccountLoginSuccessService.retrieveUsername();
- Assert.assertTrue(userName.compareTo(" ")==0);
+ assertTrue(userName.compareTo(" ")==0);
}
- @Test
+ //@Test
public void testRetrieveUsernameLoggedIn(){
makeActiveUser(emails[0]);
String userName = userAccountLoginSuccessService.retrieveUsername();
- Assert.assertNotNull(userName);
- Assert.assertTrue(emails[0].compareTo(userName) == 0);
+ assertNotNull(userName);
+ assertTrue(emails[0].compareTo(userName) == 0);
SecurityContextHolder.clearContext();
}
- @Test(expected = UsernameNotFoundException.class)
+ //@Test
+ ////@Test(expected = UsernameNotFoundException.class)
public void testRetrieveCurrentUserLoggedOut(){
userAccountLoginSuccessService.retrieveCurrentUser();
}
- @Test
+ //@Test
public void testRetrieveCurrentUserLoggedIn(){
makeActiveUser(emails[0]);
UserAccount userAccount = userAccountLoginSuccessService.retrieveCurrentUser();
- Assert.assertNotNull(userAccount);
- Assert.assertTrue(emails[0].compareTo(userAccount.getUserEmail()) == 0);
+ assertNotNull(userAccount);
+ assertTrue(emails[0].compareTo(userAccount.getUserEmail()) == 0);
SecurityContextHolder.clearContext();
deleteAll();
}
diff --git a/src/test/java/org/woehlke/simpleworklist/user/login/UserLoginControllerTest.java b/src/test/java/org/woehlke/simpleworklist/user/login/UserLoginControllerTest.java
index 19857a66..2d128668 100644
--- a/src/test/java/org/woehlke/simpleworklist/user/login/UserLoginControllerTest.java
+++ b/src/test/java/org/woehlke/simpleworklist/user/login/UserLoginControllerTest.java
@@ -5,19 +5,18 @@
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
-import org.junit.Test;
-import org.woehlke.simpleworklist.AbstractTest;
+import org.woehlke.simpleworklist.config.AbstractTest;
public class UserLoginControllerTest extends AbstractTest {
- @Test
+ //@Test
public void testLoginFormular() throws Exception {
this.mockMvc.perform(
- get("/login")).andDo(print())
- .andExpect(view().name(containsString("user/loginForm")));
+ get("/user/login")).andDo(print())
+ .andExpect(view().name(containsString("user/login/loginForm")));
}
- @Test
+ //@Test
public void testFinish() {
deleteAll();
}
diff --git a/src/test/java/org/woehlke/simpleworklist/user/register/UserRegistrationControllerTest.java b/src/test/java/org/woehlke/simpleworklist/user/register/UserRegistrationControllerTest.java
index 470605f8..dcb09412 100644
--- a/src/test/java/org/woehlke/simpleworklist/user/register/UserRegistrationControllerTest.java
+++ b/src/test/java/org/woehlke/simpleworklist/user/register/UserRegistrationControllerTest.java
@@ -1,15 +1,12 @@
package org.woehlke.simpleworklist.user.register;
-import org.junit.Assert;
-import org.junit.Test;
-import org.woehlke.simpleworklist.AbstractTest;
-import org.woehlke.simpleworklist.user.register.UserRegistration;
-import org.woehlke.simpleworklist.user.register.UserRegistrationStatus;
-import org.woehlke.simpleworklist.user.register.UserRegistrationService;
+import org.woehlke.simpleworklist.config.AbstractTest;
import org.springframework.beans.factory.annotation.Autowired;
import static org.hamcrest.Matchers.containsString;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
@@ -18,25 +15,24 @@
public class UserRegistrationControllerTest extends AbstractTest {
-
@Autowired
private UserRegistrationService userRegistrationService;
- @Test
+ //@Test
public void testSignInFormularEmail() throws Exception {
this.mockMvc.perform(
- get("/register")).andDo(print())
- .andExpect(view().name(containsString("user/registerForm")));
+ get("/user/register")).andDo(print())
+ .andExpect(view().name(containsString("user/register/registerForm")));
}
- @Test
+ //@Test
public void testSignInFormularAccount() throws Exception {
this.mockMvc.perform(
- get("/confirm/ASDF")).andDo(print())
- .andExpect(view().name(containsString("user/registerNotConfirmed")));
+ get("/user/register/confirm/ASDF")).andDo(print())
+ .andExpect(view().name(containsString("user/register/registerNotConfirmed")));
}
- @Test
+ //@Test
public void testRegisterNewUserCheckResponseAndRegistrationForm() throws Exception{
userRegistrationService.registrationSendEmailTo(emails[0]);
try {
@@ -45,19 +41,19 @@ public void testRegisterNewUserCheckResponseAndRegistrationForm() throws Excepti
e.printStackTrace();
}
UserRegistration o = testHelperService.findByEmailRegistration(emails[0]);
- Assert.assertNotNull(o);
+ assertNotNull(o);
boolean result = o.getDoubleOptInStatus()== UserRegistrationStatus.REGISTRATION_SAVED_EMAIL
|| o.getDoubleOptInStatus()== UserRegistrationStatus.REGISTRATION_SENT_MAIL;
- Assert.assertTrue(result);
- String url = "/confirm/"+o.getToken();
+ assertTrue(result);
+ String url = "/user/register/confirm/"+o.getToken();
this.mockMvc.perform(
get(url)).andDo(print())
- .andExpect(view().name(containsString("user/registerConfirmed")))
+ .andExpect(view().name(containsString("user/register/registerConfirmed")))
.andExpect(model().attributeExists("userAccountFormBean"));
userRegistrationService.registrationUserCreated(o);
}
- @Test
+ //@Test
public void finish(){
super.deleteAll();
}
diff --git a/src/test/java/org/woehlke/simpleworklist/user/register/UserRegistrationServiceImplTest.java b/src/test/java/org/woehlke/simpleworklist/user/register/UserRegistrationServiceImplTest.java
index 64f5be8f..99d2b26a 100644
--- a/src/test/java/org/woehlke/simpleworklist/user/register/UserRegistrationServiceImplTest.java
+++ b/src/test/java/org/woehlke/simpleworklist/user/register/UserRegistrationServiceImplTest.java
@@ -1,17 +1,15 @@
package org.woehlke.simpleworklist.user.register;
-import org.junit.Assert;
-import org.junit.Test;
import org.springframework.beans.factory.annotation.Value;
-import org.woehlke.simpleworklist.AbstractTest;
+import org.woehlke.simpleworklist.config.AbstractTest;
import org.woehlke.simpleworklist.user.resetpassword.UserPasswordRecovery;
-import org.woehlke.simpleworklist.user.register.UserRegistration;
import org.woehlke.simpleworklist.user.resetpassword.UserPasswordRecoveryService;
-import org.woehlke.simpleworklist.user.register.UserRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
+import static org.junit.jupiter.api.Assertions.*;
+
public class UserRegistrationServiceImplTest extends AbstractTest {
@Value("${worklist.registration.max.retries}")
@@ -26,11 +24,11 @@ public class UserRegistrationServiceImplTest extends AbstractTest {
@Autowired
private UserPasswordRecoveryService userPasswordRecoveryService;
- @Test
+ //@Test
public void testIsRetryAndMaximumNumberOfRetries(){
deleteAll();
boolean result = userRegistrationService.registrationIsRetryAndMaximumNumberOfRetries(username_email);
- Assert.assertFalse(result);
+ assertFalse(result);
userRegistrationService.registrationSendEmailTo(emails[0]);
try {
Thread.sleep(3000);
@@ -38,28 +36,28 @@ public void testIsRetryAndMaximumNumberOfRetries(){
e.printStackTrace();
}
UserRegistration o = testHelperService.findByEmailRegistration(emails[0]);
- Assert.assertTrue(o.getEmail().compareTo(emails[0])==0);
+ assertTrue(o.getEmail().compareTo(emails[0])==0);
o.setNumberOfRetries(maxRetries);
userRegistrationService.registrationClickedInEmail(o);
result = userRegistrationService.registrationIsRetryAndMaximumNumberOfRetries(emails[0]);
- Assert.assertTrue(result);
+ assertTrue(result);
}
- @Test
+ //@Test
public void testCheckIfResponseIsInTimeNewUser(){
userRegistrationService.registrationCheckIfResponseIsInTime(emails[0]);
UserRegistration o = testHelperService.findByEmailRegistration(emails[0]);
- Assert.assertNotNull(o);
+ assertNotNull(o);
o.setRowCreatedAt(new Date(o.getRowCreatedAt().getTime() - ttlEmailVerificationRequest));
o.setNumberOfRetries(0);
userRegistrationService.registrationClickedInEmail(o);
userRegistrationService.registrationCheckIfResponseIsInTime(emails[0]);
o = testHelperService.findByEmailRegistration(emails[0]);
- Assert.assertNull(o);
+ assertNull(o);
}
- @Test
+ //@Test
public void testCheckIfResponseIsInTime(){
userPasswordRecoveryService.passwordRecoverySendEmailTo(emails[0]);
try {
@@ -69,12 +67,12 @@ public void testCheckIfResponseIsInTime(){
}
userPasswordRecoveryService.passwordRecoveryCheckIfResponseIsInTime(emails[0]);
UserPasswordRecovery o = testHelperService.findByEmailPasswordRecovery(emails[0]);
- Assert.assertNotNull(o);
+ assertNotNull(o);
o.setRowCreatedAt(new Date(o.getRowCreatedAt().getTime() - ttlEmailVerificationRequest));
o.setNumberOfRetries(0);
userPasswordRecoveryService.passwordRecoveryClickedInEmail(o);
userPasswordRecoveryService.passwordRecoveryCheckIfResponseIsInTime(emails[0]);
o = testHelperService.findByEmailPasswordRecovery(emails[0]);
- Assert.assertNull(o);
+ assertNull(o);
}
}
diff --git a/src/test/java/org/woehlke/simpleworklist/user/resetpassword/UserPasswordRecoveryControllerTest.java b/src/test/java/org/woehlke/simpleworklist/user/resetpassword/UserPasswordRecoveryControllerTest.java
index 5c6e82b8..126a5af1 100644
--- a/src/test/java/org/woehlke/simpleworklist/user/resetpassword/UserPasswordRecoveryControllerTest.java
+++ b/src/test/java/org/woehlke/simpleworklist/user/resetpassword/UserPasswordRecoveryControllerTest.java
@@ -1,15 +1,12 @@
package org.woehlke.simpleworklist.user.resetpassword;
-import org.junit.Assert;
-import org.junit.Test;
-import org.woehlke.simpleworklist.AbstractTest;
-import org.woehlke.simpleworklist.user.resetpassword.UserPasswordRecovery;
-import org.woehlke.simpleworklist.user.resetpassword.UserPasswordRecoveryStatus;
-import org.woehlke.simpleworklist.user.resetpassword.UserPasswordRecoveryService;
+import org.woehlke.simpleworklist.config.AbstractTest;
import org.springframework.beans.factory.annotation.Autowired;
import static org.hamcrest.Matchers.containsString;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
@@ -20,21 +17,21 @@ public class UserPasswordRecoveryControllerTest extends AbstractTest {
@Autowired
private UserPasswordRecoveryService userPasswordRecoveryService;
- @Test
+ //@Test
public void testResetPassword() throws Exception {
this.mockMvc.perform(
- get("/resetPassword")).andDo(print())
- .andExpect(view().name(containsString("user/resetPasswordForm")));
+ get("/user/resetPassword")).andDo(print())
+ .andExpect(view().name(containsString("user/resetPassword/resetPasswordForm")));
}
- @Test
+ //@Test
public void testEnterNewPasswordFormular() throws Exception {
this.mockMvc.perform(
- get("/passwordResetConfirm/ASDF")).andDo(print())
- .andExpect(view().name(containsString("user/resetPasswordNotConfirmed")));
+ get("/user/resetPassword/confirm/ASDF")).andDo(print())
+ .andExpect(view().name(containsString("user/resetPassword/resetPasswordNotConfirmed")));
}
- @Test
+ //@Test
public void testEnterNewPasswordFormularWithToken() throws Exception {
userPasswordRecoveryService.passwordRecoverySendEmailTo(emails[0]);
try {
@@ -43,19 +40,19 @@ public void testEnterNewPasswordFormularWithToken() throws Exception {
e.printStackTrace();
}
UserPasswordRecovery o = testHelperService.findByEmailPasswordRecovery(emails[0]);
- Assert.assertNotNull(o);
+ assertNotNull(o);
boolean result = o.getDoubleOptInStatus()== UserPasswordRecoveryStatus.PASSWORD_RECOVERY_SAVED_EMAIL
|| o.getDoubleOptInStatus()== UserPasswordRecoveryStatus.PASSWORD_RECOVERY_SENT_EMAIL;
- Assert.assertTrue(result);
- String url = "/passwordResetConfirm/"+o.getToken();
+ assertTrue(result);
+ String url = "/user/resetPassword/confirm/"+o.getToken();
this.mockMvc.perform(
get(url)).andDo(print())
- .andExpect(view().name(containsString("user/resetPasswordConfirmed")))
+ .andExpect(view().name(containsString("user/resetPassword/resetPasswordConfirmed")))
.andExpect(model().attributeExists("userAccountFormBean"));
userPasswordRecoveryService.passwordRecoveryDone(o);
}
- @Test
+ //@Test
public void finish(){
super.deleteAll();
}
diff --git a/src/test/java/org/woehlke/simpleworklist/userstories/F001ServerStartsTest.java b/src/test/java/org/woehlke/simpleworklist/userstories/F001ServerStartsTest.java
deleted file mode 100644
index 460f9063..00000000
--- a/src/test/java/org/woehlke/simpleworklist/userstories/F001ServerStartsTest.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.woehlke.simpleworklist.userstories;
-
-public class F001ServerStartsTest {
-}
diff --git a/src/test/java/org/woehlke/simpleworklist/userstories/F002HomePageRenderedTest.java b/src/test/java/org/woehlke/simpleworklist/userstories/F002HomePageRenderedTest.java
deleted file mode 100644
index c1977eb7..00000000
--- a/src/test/java/org/woehlke/simpleworklist/userstories/F002HomePageRenderedTest.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.woehlke.simpleworklist.userstories;
-
-public class F002HomePageRenderedTest {
-}
diff --git a/src/test/java/org/woehlke/simpleworklist/userstories/F003RegistrationTest.java b/src/test/java/org/woehlke/simpleworklist/userstories/F003RegistrationTest.java
deleted file mode 100644
index 4f3dc3de..00000000
--- a/src/test/java/org/woehlke/simpleworklist/userstories/F003RegistrationTest.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.woehlke.simpleworklist.userstories;
-
-public class F003RegistrationTest {
-}
diff --git a/src/test/java/org/woehlke/simpleworklist/userstories/F004PasswordRecoveryTest.java b/src/test/java/org/woehlke/simpleworklist/userstories/F004PasswordRecoveryTest.java
deleted file mode 100644
index 241abb6c..00000000
--- a/src/test/java/org/woehlke/simpleworklist/userstories/F004PasswordRecoveryTest.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.woehlke.simpleworklist.userstories;
-
-public class F004PasswordRecoveryTest {
-}
diff --git a/src/test/java/org/woehlke/simpleworklist/userstories/F005LoginTest.java b/src/test/java/org/woehlke/simpleworklist/userstories/F005LoginTest.java
deleted file mode 100644
index c62ff789..00000000
--- a/src/test/java/org/woehlke/simpleworklist/userstories/F005LoginTest.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.woehlke.simpleworklist.userstories;
-
-public class F005LoginTest {
-}
diff --git a/src/test/java/org/woehlke/simpleworklist/userstories/F006PageAfterFirstSuccessfulLoginTest.java b/src/test/java/org/woehlke/simpleworklist/userstories/F006PageAfterFirstSuccessfulLoginTest.java
deleted file mode 100644
index 426d6d6f..00000000
--- a/src/test/java/org/woehlke/simpleworklist/userstories/F006PageAfterFirstSuccessfulLoginTest.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.woehlke.simpleworklist.userstories;
-
-public class F006PageAfterFirstSuccessfulLoginTest {
-}
diff --git a/src/test/java/org/woehlke/simpleworklist/userstories/F007AddFirstNewTask.java b/src/test/java/org/woehlke/simpleworklist/userstories/F007AddFirstNewTask.java
deleted file mode 100644
index 7986ee9e..00000000
--- a/src/test/java/org/woehlke/simpleworklist/userstories/F007AddFirstNewTask.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.woehlke.simpleworklist.userstories;
-
-public class F007AddFirstNewTask {
-}
diff --git a/src/test/java/org/woehlke/simpleworklist/userstories/F008AddFirstNewProject.java b/src/test/java/org/woehlke/simpleworklist/userstories/F008AddFirstNewProject.java
deleted file mode 100644
index 4c1596c0..00000000
--- a/src/test/java/org/woehlke/simpleworklist/userstories/F008AddFirstNewProject.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.woehlke.simpleworklist.userstories;
-
-public class F008AddFirstNewProject {
-}
diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml
new file mode 100644
index 00000000..f3d1b472
--- /dev/null
+++ b/src/test/resources/application.yml
@@ -0,0 +1,228 @@
+server:
+ port: ${PORT}
+ error:
+ path: /fehler
+ compression:
+ enabled: false
+ min-response-size: 2048
+spring:
+ datasource:
+ url: jdbc:postgresql://localhost:5432//simpleworklist
+ username: simpleworklist
+ password: simpleworklistpwd
+ driverClassName: org.postgresql.Driver
+ platform: postgresql
+ jpa:
+ show-sql: true
+ open-in-view: true
+ generate-ddl: true
+ hibernate:
+ ddl-auto: ${JPA_DLL_AUTO}
+ properties:
+ hibernate:
+ dialect: org.hibernate.dialect.PostgreSQL95Dialect
+ temp:
+ use_jdbc_metadata_defaults: false
+ session:
+ store-type: jdbc
+ jdbc:
+ initialize-schema: always
+ thymeleaf:
+ cache: false
+ main:
+ allow-bean-definition-overriding: true
+org:
+ woehlke:
+ simpleworklist:
+ mail:
+ host: ${MAIL_SMTP_HOST}
+ port: ${MAIL_SMTP_PORT}
+ username: ${MAIL_SMTP_USERNAME}
+ password: ${MAIL_SMTP_PASSWORD}
+ auth: true
+ sslEnable: true
+ socketFactoryPort: 465
+ socketFactoryClass: javax.net.ssl.SSLSocketFactory
+ registration:
+ maxRetries: 5
+ ttlEmailVerificationRequest: 86400000
+ urlHost: ${MAIL_URL_APP_HOST}
+ mailFrom: ${MAIL_FROM}
+ webMvc:
+ controllerPageSize: 10
+ staticResourceHandler:
+ - "/css"
+ - "/img"
+ - "/js"
+ dynaicResourceHandler:
+ - "/webjars"
+ webSecurity:
+ loginProcessingUrl: "/j_spring_security_check"
+ logoutUrl: "/user/logout"
+ cookieNamesToClear:
+ - "JSESSIONID"
+ invalidateHttpSession: true
+ defaultSuccessUrl: "/"
+ failureForwardUrl: "/user/login?login_error=1"
+ usernameParameter: "j_username"
+ passwordParameter: "j_password"
+ loginPage: "/user/login"
+ antPatternsPublic:
+ - "/webjars/**"
+ - "/css/**"
+ - "/img/**"
+ - "/js/**"
+ - "/favicon.ico"
+ - "/user/login*"
+ - "/user/register*"
+ - "/user/register/confirm/**"
+ - "/user/resetPassword*"
+ - "/user/resetPassword/confirm/**"
+ - "/error*"
+ strengthBCryptPasswordEncoder: 10
+---
+spring:
+ profiles: default
+ datasource:
+ url: jdbc:postgresql://localhost:5432/simpleworklist
+---
+spring:
+ profiles: developing
+ datasource:
+ url: jdbc:postgresql://localhost:5432/simpleworklist_developing
+ jpa:
+ hibernate:
+ ddl-auto: update
+ #ddl-auto: create-drop
+---
+spring:
+ profiles: travis
+ datasource:
+ url: jdbc:postgresql://localhost:5432/simpleworklist_travis
+ continue-on-error: true
+ jpa:
+ show-sql: false
+ hibernate:
+ ddl-auto: update
+ #ddl-auto: create-drop
+server:
+ compression:
+ enabled: false
+---
+spring:
+ profiles: testing
+ datasource:
+ url: jdbc:postgresql://localhost:5432/simpleworklist_testing
+ jpa:
+ show-sql: false
+ hibernate:
+ ddl-auto: update
+ #ddl-auto: create-drop
+server:
+ compression:
+ enabled: false
+logging:
+ config: classpath:logback.xml
+ file: logging-test.log
+ level:
+ org:
+ woehlke:
+ simpleworklist: DEBUG
+ application: DEBUG
+ config: DEBUG
+ control:
+ admin: DEBUG
+ anonymous: DEBUG
+ common: DEBUG
+ user: DEBUG
+ model:
+ beans: DEBUG
+ dao: DEBUG
+ services: DEBUG
+ oodm:
+ entities: DEBUG
+ repository: DEBUG
+ services:
+ impl: DEBUG
+---
+spring:
+ profiles: qa
+ datasource:
+ url: jdbc:postgresql://localhost:5432/simpleworklist_qa
+ continue-on-error: true
+ jpa:
+ show-sql: false
+ hibernate:
+ ddl-auto: update
+ #ddl-auto: create-drop
+server:
+ compression:
+ enabled: false
+logging:
+ config: classpath:logback.xml
+ file: logging-qa.log
+ level:
+ org:
+ woehlke:
+ simpleworklist: DEBUG
+ application: DEBUG
+ config: DEBUG
+ control:
+ admin: DEBUG
+ anonymous: DEBUG
+ common: DEBUG
+ user: DEBUG
+ model:
+ beans: DEBUG
+ dao: DEBUG
+ services: DEBUG
+ oodm:
+ entities: DEBUG
+ repository: DEBUG
+ services:
+ impl: DEBUG
+---
+spring:
+ profiles: heroku
+ datasource:
+ url: jdbc:postgresql://localhost:5432/simpleworklist_heroku
+ continue-on-error: true
+ jpa:
+ show-sql: false
+ hibernate:
+ ddl-auto: update
+ #ddl-auto: create-drop
+ properties:
+ hibernate:
+ search:
+ default:
+ indexBase : /tmp/simpleworklistsearch
+ thymeleaf:
+ cache: true
+ devtools:
+ livereload:
+ enabled: false
+ application:
+ admin:
+ enabled: false
+server:
+ compression:
+ enabled: true
+org:
+ woehlke:
+ simpleworklist:
+ registration:
+ urlHost: simpleworklist.herokuapp.com
+logging:
+ config: classpath:logback.xml
+ level:
+ org:
+ woehlke:
+ simpleworklist: WARN
+ apache: WARN
+ springframework: WARN
+ thymeleaf: WARN
+ hibernate: WARN
+ hibernate.SQL: WARN
+ ch:
+ qos: WARN
diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml
new file mode 100644
index 00000000..ef437351
--- /dev/null
+++ b/src/test/resources/logback.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/test-context.xml b/src/test/resources/test-context.xml
deleted file mode 100644
index 4aa6a7d9..00000000
--- a/src/test/resources/test-context.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-