fix:azure devops平台创建的bug未同步到metersphere(#ID1010762)
fix:github#11072,Azure Devops 提交缺陷 ,不支持上传图片(#ID1010759) feat:tfs 缺陷和需求关联,缺陷能够挂在需求下(ID1004746)
This commit is contained in:
parent
be4c0e497d
commit
a64a4319b1
|
@ -310,6 +310,21 @@ public class FileUtils {
|
|||
return buffer;
|
||||
}
|
||||
|
||||
public static String fileToStr(File tradeFile) {
|
||||
String buffer = null;
|
||||
try (FileInputStream fis = new FileInputStream(tradeFile);
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();) {
|
||||
byte[] b = new byte[1024];
|
||||
int n;
|
||||
while ((n = fis.read(b)) != -1) {
|
||||
bos.write(b, 0, n);
|
||||
}
|
||||
buffer = bos.toString();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public List<Object> getZipJar() {
|
||||
List<Object> jarFiles = new LinkedList<>();
|
||||
// jar 包
|
||||
|
|
|
@ -18,6 +18,7 @@ import io.metersphere.dto.IssueTemplateDao;
|
|||
import io.metersphere.dto.UserDTO;
|
||||
import io.metersphere.service.*;
|
||||
import io.metersphere.track.issue.domain.ProjectIssueConfig;
|
||||
import io.metersphere.track.request.testcase.EditTestCaseRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
import io.metersphere.track.service.IssuesService;
|
||||
|
@ -527,4 +528,25 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
public Boolean checkProjectExist(String relateId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除缺陷的Parent关联
|
||||
* @param request
|
||||
*/
|
||||
@Override
|
||||
public void removeIssueParentLink(IssuesUpdateRequest request) {
|
||||
// 添加方法体逻辑可重写改方法
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新需求与缺陷的关联关系
|
||||
* @param testCase
|
||||
* @param project
|
||||
*/
|
||||
@Override
|
||||
public void updateDemandIssueLink(EditTestCaseRequest testCase, Project project) {
|
||||
// 添加方法体逻辑可重写改方法
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.dto.IssueTemplateDao;
|
|||
import io.metersphere.dto.UserDTO;
|
||||
import io.metersphere.track.dto.DemandDTO;
|
||||
import io.metersphere.track.issue.domain.PlatformUser;
|
||||
import io.metersphere.track.request.testcase.EditTestCaseRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
|
||||
|
@ -85,4 +86,17 @@ public interface IssuesPlatform {
|
|||
* @return Boolean
|
||||
*/
|
||||
Boolean checkProjectExist(String relateId);
|
||||
|
||||
/**
|
||||
* 更新缺陷关联关系
|
||||
* @param request
|
||||
*/
|
||||
void removeIssueParentLink(IssuesUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 更新需求与缺陷关联关系
|
||||
*
|
||||
* @param testCase
|
||||
*/
|
||||
void updateDemandIssueLink(EditTestCaseRequest testCase, Project project);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,16 @@ public class AzureDevopsWorkItemsBatchResponse {
|
|||
private String systemWorkItemType;
|
||||
@JSONField(name = "System.Title")
|
||||
private String systemTitle;
|
||||
@JSONField(name = "System.State")
|
||||
private String state;
|
||||
@JSONField(name = "System.Description")
|
||||
private String description;
|
||||
@JSONField(name = "System.AssignedTo")
|
||||
private String assignedTo;
|
||||
@JSONField(name = "System.ChangedBy")
|
||||
private String changedBy;
|
||||
@JSONField(name = "System.CreatedBy")
|
||||
private String createdBy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,4 +30,8 @@ public class IssuesUpdateRequest extends IssuesWithBLOBs {
|
|||
private List<String> deleteResourceIds;
|
||||
private Boolean isPlanEdit = false;
|
||||
private String refId;
|
||||
/**
|
||||
* azure devops bug同步fields
|
||||
*/
|
||||
private String devopsFields;
|
||||
}
|
||||
|
|
|
@ -288,6 +288,16 @@ public class IssuesService {
|
|||
testCaseIssuesMapper.deleteByExample(example);
|
||||
testCaseIssueService.updateIssuesCount(caseResourceId);
|
||||
} else {
|
||||
IssuesUpdateRequest updateRequest = new IssuesUpdateRequest();
|
||||
updateRequest.setId(request.getId());
|
||||
updateRequest.setResourceId(request.getCaseResourceId());
|
||||
updateRequest.setProjectId(request.getProjectId());
|
||||
updateRequest.setWorkspaceId(request.getWorkspaceId());
|
||||
List<AbstractIssuePlatform> platformList = getUpdatePlatforms(updateRequest);
|
||||
platformList.forEach(platform -> {
|
||||
platform.removeIssueParentLink(updateRequest);
|
||||
});
|
||||
|
||||
extIssuesMapper.deleteIssues(id, caseResourceId);
|
||||
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample();
|
||||
testPlanTestCaseExample.createCriteria().andCaseIdEqualTo(caseResourceId);
|
||||
|
|
|
@ -71,6 +71,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -288,6 +289,10 @@ public class TestCaseService {
|
|||
if (StringUtils.isNotBlank(testCase.getVersionId())) {
|
||||
example.getOredCriteria().get(0).andVersionIdEqualTo(testCase.getVersionId());
|
||||
}
|
||||
updateThirdPartyIssuesLink(testCase);
|
||||
if (StringUtils.isEmpty(testCase.getDemandId())) {
|
||||
testCase.setDemandId("");
|
||||
}
|
||||
createNewVersionOrNot(testCase, example);
|
||||
|
||||
if (StringUtils.isNotBlank(testCase.getCustomNum()) && StringUtils.isNotBlank(testCase.getId())) {
|
||||
|
@ -306,6 +311,22 @@ public class TestCaseService {
|
|||
return testCaseMapper.selectByPrimaryKey(testCase.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断azure devops用例关联的需求是否发生变更,若发生变更,则重新建立需求与缺陷的关联关系
|
||||
* @param testCase
|
||||
*/
|
||||
private void updateThirdPartyIssuesLink(EditTestCaseRequest testCase) {
|
||||
try {
|
||||
if (Class.forName("io.metersphere.xpack.issue.service.XpackIssueService") != null) {
|
||||
Class clazz = Class.forName("io.metersphere.xpack.issue.service.XpackIssueService");
|
||||
Method method = clazz.getMethod("updateThirdPartyIssuesLink", EditTestCaseRequest.class);
|
||||
method.invoke(CommonBeanFactory.getBean("xpackIssueService"), testCase);
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
LogUtil.error("不存在XpackIssueService类");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据前后端 verionId 判定是编辑旧数据还是创建新版本
|
||||
*
|
||||
|
|
|
@ -111,6 +111,7 @@ import IssueRelateList from "@/business/components/track/case/components/IssueRe
|
|||
import {deleteIssueRelate, getIssuePartTemplateWithProject, getIssuesByCaseId} from "@/network/Issue";
|
||||
import {getCustomFieldValue, getTableHeaderWithCustomFields} from "@/common/js/tableUtils";
|
||||
import {LOCAL} from "@/common/js/constants";
|
||||
import {getCurrentProjectID, getCurrentWorkspaceId} from "@/common/js/utils";
|
||||
export default {
|
||||
name: "TestCaseIssueRelate",
|
||||
components: {IssueRelateList, IssueDescriptionTableItem, MsTableColumn, MsTable, TestPlanIssueEdit},
|
||||
|
@ -148,6 +149,9 @@ export default {
|
|||
},
|
||||
notInIds() {
|
||||
return this.page.data ? this.page.data.map(i => i.id) : [];
|
||||
},
|
||||
projectId() {
|
||||
return getCurrentProjectID();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -236,7 +240,9 @@ export default {
|
|||
this.page.result = deleteIssueRelate({
|
||||
id: row.id,
|
||||
caseResourceId: this.getCaseResourceId(),
|
||||
isPlanEdit: this.planId ? true : false
|
||||
isPlanEdit: this.planId ? true : false,
|
||||
projectId: this.projectId,
|
||||
workspaceId: getCurrentWorkspaceId()
|
||||
}, () => {
|
||||
this.getIssues();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
|
|
Loading…
Reference in New Issue