|
18 | 18 | package org.apache.seata.namingserver.smoke; |
19 | 19 |
|
20 | 20 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 21 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
21 | 22 |
|
| 23 | +import org.apache.seata.console.security.CustomUserDetailsServiceImpl; |
22 | 24 | import org.apache.seata.namingserver.NamingserverApplication; |
23 | 25 | import org.junit.jupiter.api.Test; |
24 | 26 | import org.junit.jupiter.api.extension.ExtendWith; |
| 27 | +import org.springframework.beans.factory.annotation.Autowired; |
25 | 28 | import org.springframework.boot.test.context.SpringBootTest; |
26 | 29 | import org.springframework.boot.test.system.CapturedOutput; |
27 | 30 | import org.springframework.boot.test.system.OutputCaptureExtension; |
| 31 | +import org.springframework.security.core.userdetails.UserDetails; |
28 | 32 |
|
29 | 33 | @SpringBootTest( |
30 | 34 | classes = NamingserverApplication.class, |
31 | 35 | webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, |
32 | | - properties = "console.user.password=foo") |
| 36 | + properties = {"console.user.username=seata", "console.user.password=foo"}) |
33 | 37 | @ExtendWith(OutputCaptureExtension.class) |
34 | 38 | class NamingControllerPropertiesSmokeTest { |
35 | 39 |
|
| 40 | + @Autowired |
| 41 | + private CustomUserDetailsServiceImpl customUserDetailsService; |
| 42 | + |
36 | 43 | @Test |
37 | 44 | void processShouldNotPrintLogsAndGeneratePasswordWhenPasswordIsDefined(CapturedOutput output) { |
38 | 45 | String logs = output.getOut(); |
39 | 46 | assertFalse(logs.contains("No password was configured.")); |
| 47 | + |
| 48 | + // TODO: When apply PasswordEncoder modify this test |
| 49 | + UserDetails userDetails = customUserDetailsService.loadUserByUsername("seata"); |
| 50 | + assertTrue(userDetails.getPassword().equals("foo")); |
40 | 51 | } |
41 | 52 | } |
0 commit comments