|
|
@@ -1,87 +1,87 @@
|
|
|
-package seecoder.devcloud.web.service.user;
|
|
|
-
|
|
|
-import org.gitlab4j.api.GitLabApi;
|
|
|
-import org.gitlab4j.api.GitLabApiException;
|
|
|
-import org.junit.Assert;
|
|
|
-import org.junit.jupiter.api.BeforeEach;
|
|
|
-import org.junit.jupiter.api.Test;
|
|
|
-import org.junit.runner.RunWith;
|
|
|
-import org.mybatis.spring.annotation.MapperScan;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.boot.test.context.SpringBootTest;
|
|
|
-import org.springframework.test.context.junit4.SpringRunner;
|
|
|
-import seecoder.devcloud.api.ApplicationProperties;
|
|
|
-import seecoder.devcloud.common.exceptions.EntityNotFoundException;
|
|
|
-import seecoder.devcloud.common.exceptions.ServiceException;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author PuHong Weng
|
|
|
- * @date 2021/3/4
|
|
|
- * @description: 与gitlab交互,没有办法配事务,只能手动测试。mvn test的时候请排除这个类
|
|
|
- */
|
|
|
-@RunWith(SpringRunner.class)
|
|
|
-@SpringBootTest
|
|
|
-@MapperScan(basePackages = {"seecoder.devcloud.web.dao"})
|
|
|
-//@Transactional
|
|
|
-class GroupServiceTest {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- GroupService groupService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- UserService userService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ApplicationProperties properties;
|
|
|
-
|
|
|
- /**
|
|
|
- * 注意 GitlabApi 和 GitLabApi 区别
|
|
|
- * GitlabApi 是我们对 GitLabApi 的一个小封装
|
|
|
- * 这里作辅助测试用
|
|
|
- */
|
|
|
- GitLabApi gitLabApi;
|
|
|
-
|
|
|
- @BeforeEach
|
|
|
- void setUp() {
|
|
|
- gitLabApi = new GitLabApi(properties.getGitlab().getHost(), properties.getGitlab().getToken());
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- void help(){
|
|
|
- try {
|
|
|
- //gitLabApi.getGroupApi().deleteGroup(46);
|
|
|
- System.out.println(gitLabApi.getGroupApi().getGroups());
|
|
|
- } catch (GitLabApiException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Test
|
|
|
- void createGroup() {
|
|
|
- int userId = 36;
|
|
|
- try {
|
|
|
- System.out.println(groupService.createGroup("test"));
|
|
|
- } catch (Exception e) {
|
|
|
- Assert.fail(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- void addMember() {
|
|
|
- int groupId = 51;
|
|
|
- int userId = 36;
|
|
|
- int invitedUserId = 37;
|
|
|
- try {
|
|
|
- groupService.addMember(invitedUserId, groupId);
|
|
|
- } catch (EntityNotFoundException e) {
|
|
|
- e.printStackTrace();
|
|
|
- Assert.fail(e.getMessage());
|
|
|
- } catch (ServiceException serviceException) {
|
|
|
- serviceException.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+//package seecoder.devcloud.web.service.user;
|
|
|
+//
|
|
|
+//import org.gitlab4j.api.GitLabApi;
|
|
|
+//import org.gitlab4j.api.GitLabApiException;
|
|
|
+//import org.junit.Assert;
|
|
|
+//import org.junit.jupiter.api.BeforeEach;
|
|
|
+//import org.junit.jupiter.api.Test;
|
|
|
+//import org.junit.runner.RunWith;
|
|
|
+//import org.mybatis.spring.annotation.MapperScan;
|
|
|
+//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+//import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+//import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+//import seecoder.devcloud.api.ApplicationProperties;
|
|
|
+//import seecoder.devcloud.common.exceptions.EntityNotFoundException;
|
|
|
+//import seecoder.devcloud.common.exceptions.ServiceException;
|
|
|
+//
|
|
|
+///**
|
|
|
+// * @author PuHong Weng
|
|
|
+// * @date 2021/3/4
|
|
|
+// * @description: 与gitlab交互,没有办法配事务,只能手动测试。mvn test的时候请排除这个类
|
|
|
+// */
|
|
|
+//@RunWith(SpringRunner.class)
|
|
|
+//@SpringBootTest
|
|
|
+//@MapperScan(basePackages = {"seecoder.devcloud.web.dao"})
|
|
|
+////@Transactional
|
|
|
+//class GroupServiceTest {
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// GroupService groupService;
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// UserService userService;
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// ApplicationProperties properties;
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 注意 GitlabApi 和 GitLabApi 区别
|
|
|
+// * GitlabApi 是我们对 GitLabApi 的一个小封装
|
|
|
+// * 这里作辅助测试用
|
|
|
+// */
|
|
|
+// GitLabApi gitLabApi;
|
|
|
+//
|
|
|
+// @BeforeEach
|
|
|
+// void setUp() {
|
|
|
+// gitLabApi = new GitLabApi(properties.getGitlab().getHost(), properties.getGitlab().getToken());
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Test
|
|
|
+// void help(){
|
|
|
+// try {
|
|
|
+// //gitLabApi.getGroupApi().deleteGroup(46);
|
|
|
+// System.out.println(gitLabApi.getGroupApi().getGroups());
|
|
|
+// } catch (GitLabApiException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @Test
|
|
|
+// void createGroup() {
|
|
|
+// int userId = 36;
|
|
|
+// try {
|
|
|
+// System.out.println(groupService.createGroup("test"));
|
|
|
+// } catch (Exception e) {
|
|
|
+// Assert.fail(e.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Test
|
|
|
+// void addMember() {
|
|
|
+// int groupId = 51;
|
|
|
+// int userId = 36;
|
|
|
+// int invitedUserId = 37;
|
|
|
+// try {
|
|
|
+// groupService.addMember(invitedUserId, groupId);
|
|
|
+// } catch (EntityNotFoundException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// Assert.fail(e.getMessage());
|
|
|
+// } catch (ServiceException serviceException) {
|
|
|
+// serviceException.printStackTrace();
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//}
|