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