|
|
@@ -1,15 +1,6 @@
|
|
|
import cn.reghao.devops.manager.ManagerApplication;
|
|
|
-import cn.reghao.devops.manager.app.db.repository.AppBuildingRepository;
|
|
|
-import cn.reghao.devops.manager.app.db.repository.AppDeployingRepository;
|
|
|
-import cn.reghao.devops.manager.app.db.repository.config.AppConfigRepository;
|
|
|
-import cn.reghao.devops.manager.app.db.repository.config.AppDeployConfigRepository;
|
|
|
-import cn.reghao.devops.manager.app.model.po.AppBuilding;
|
|
|
-import cn.reghao.devops.manager.app.model.po.AppDeploying;
|
|
|
-import cn.reghao.devops.manager.notification.NotifyService;
|
|
|
-import cn.reghao.devops.manager.notification.notifier.ding.DingMsg;
|
|
|
+import cn.reghao.devops.manager.rbac.model.dto.UserCreateDto;
|
|
|
import cn.reghao.devops.manager.rbac.service.UserService;
|
|
|
-import cn.reghao.devops.manager.util.ConsulNode;
|
|
|
-import cn.reghao.devops.manager.util.ConsulService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
@@ -18,8 +9,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
/**
|
|
|
* @author reghao
|
|
|
* @date 2022-08-17 15:53:04
|
|
|
@@ -33,55 +22,25 @@ public class AccountTest {
|
|
|
UserService userService;
|
|
|
|
|
|
@Test
|
|
|
- public void createAccount() {
|
|
|
+ public void createUserAccount() {
|
|
|
String username = "admin";
|
|
|
- int userId = 102;
|
|
|
String password = "ecUgpUeIX2ub84EYPsiQ";
|
|
|
- userService.modifyUserPassword(userId, password);
|
|
|
-
|
|
|
- /*String role = RoleType.ROLE_ADMIN.name();
|
|
|
- User user = new User(username, password, Set.of(new UserAuthority(role)));
|
|
|
- userService.createUser(user);*/
|
|
|
+ String nickname = "";
|
|
|
+ int roleId = 1;
|
|
|
+
|
|
|
+ UserCreateDto userCreateDto = new UserCreateDto();
|
|
|
+ userCreateDto.setUsername(username);
|
|
|
+ userCreateDto.setPassword(password);
|
|
|
+ userCreateDto.setNickname(nickname);
|
|
|
+ userCreateDto.setRoleId(roleId);
|
|
|
+ //userService.createUser(userCreateDto);
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- NotifyService notifyService;
|
|
|
@Test
|
|
|
- public void notifyTest() throws InterruptedException {
|
|
|
- String title = "通知测试";
|
|
|
- String text = "应用测试内容";
|
|
|
- DingMsg dingMsg = new DingMsg(title, text);
|
|
|
- notifyService.notify(dingMsg);
|
|
|
- Thread.sleep(3600_000);
|
|
|
- }
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ConsulService consulService;
|
|
|
- @Test
|
|
|
- public void consulTest() {
|
|
|
- List<ConsulNode> nodes = consulService.getNodes();
|
|
|
- List<String> serviceIds = consulService.getServices();
|
|
|
- System.out.println();
|
|
|
- }
|
|
|
-
|
|
|
- @Autowired
|
|
|
- AppBuildingRepository buildingRepository;
|
|
|
- @Autowired
|
|
|
- AppDeployingRepository deployingRepository;
|
|
|
- @Autowired
|
|
|
- AppConfigRepository configRepository;
|
|
|
- @Autowired
|
|
|
- AppDeployConfigRepository deployConfigRepository;
|
|
|
- @Test
|
|
|
- public void test11() {
|
|
|
- configRepository.findAll().forEach(appConfig -> {
|
|
|
- AppBuilding appBuilding = new AppBuilding(appConfig);
|
|
|
- buildingRepository.save(appBuilding);
|
|
|
- });
|
|
|
-
|
|
|
- /*deployConfigRepository.findAll().forEach(appDeployConfig -> {
|
|
|
- AppDeploying appDeploying = new AppDeploying(appDeployConfig);
|
|
|
- deployingRepository.save(appDeploying);
|
|
|
- });*/
|
|
|
+ public void updateUserPassword() {
|
|
|
+ String username = "admin";
|
|
|
+ int userId = 102;
|
|
|
+ String password = "ecUgpUeIX2ub84EYPsiQ";
|
|
|
+ userService.modifyUserPassword(userId, password);
|
|
|
}
|
|
|
}
|