use of com.hp.octane.integrations.services.vulnerabilities.ssc.dto.IssueDetails in project octane-ci-java-sdk by MicroFocus.
the class SSCHandler method getIssuesExtendedData.
public Map<Integer, IssueDetails> getIssuesExtendedData(List<Issues.Issue> issues) {
HashMap<Integer, IssueDetails> idToDetails = new HashMap<>();
try {
for (Issues.Issue issue : issues) {
IssueDetails issueDetails = sscProjectConnector.getIssueDetails(issue.id);
idToDetails.put(issue.id, issueDetails);
}
} catch (Exception e) {
logger.error("failed to add extended data for issues", e);
}
return idToDetails;
}
use of com.hp.octane.integrations.services.vulnerabilities.ssc.dto.IssueDetails in project octane-ci-java-sdk by MicroFocus.
the class PackIssuesToSendToOctaneTest method packIssuesToNewAndUpdate.
@Test
public void packIssuesToNewAndUpdate() throws IOException {
Issues issues = sscIssuesToPack();
Map<Integer, IssueDetails> idToDetails = getAllData();
PackIssuesToOctaneUtils.SortedIssues<Issues.Issue> issueSortedIssues = PackIssuesToOctaneUtils.packToOctaneIssues(issues.getData(), new ArrayList<>(), true);
Assert.assertEquals(2, issueSortedIssues.issuesToUpdate.size());
Assert.assertEquals(2, issueSortedIssues.issuesRequiredExtendedData.size());
Assert.assertEquals(0, issueSortedIssues.issuesToClose.size());
List<OctaneIssue> openOctaneIssues = createOctaneIssues(issueSortedIssues.issuesToUpdate, "Tag", idToDetails);
validateIssueMap(openOctaneIssues.get(0), "list_node.issue_state_node.new", "\\ABC\\DEF\\GHIJ.java", "1", "Kingdom1", "Issue1");
validateIssueMap(openOctaneIssues.get(1), "list_node.issue_state_node.existing", "\\ABC\\DEF\\GHIJ\\KLM.java", "2", "Kingdom2", "Issue2");
validateRemoteIdAndExtendedIssues(openOctaneIssues.get(0), "RemoteId1", idToDetails.get(1));
validateRemoteIdAndExtendedIssues(openOctaneIssues.get(1), "RemoteId2", idToDetails.get(2));
}
use of com.hp.octane.integrations.services.vulnerabilities.ssc.dto.IssueDetails in project octane-ci-java-sdk by MicroFocus.
the class PackIssuesToSendToOctaneTest method getAllData.
private Map<Integer, IssueDetails> getAllData() {
IssueDetails issueDetails1 = new IssueDetails();
issueDetails1.setData(new IssueDetails.IssueDetailsData());
issueDetails1.getData().brief = "summary1";
issueDetails1.getData().detail = "explanation1";
issueDetails1.getData().recommendation = "recommendations1";
issueDetails1.getData().tips = "tips1";
IssueDetails issueDetails2 = new IssueDetails();
issueDetails2.setData(new IssueDetails.IssueDetailsData());
issueDetails2.getData().brief = "summary2";
issueDetails2.getData().detail = "explanation2";
issueDetails2.getData().recommendation = "recommendations2";
issueDetails2.getData().tips = "tips2";
HashMap<Integer, IssueDetails> retVal = new HashMap<>();
retVal.put(1, issueDetails1);
retVal.put(2, issueDetails2);
return retVal;
}
use of com.hp.octane.integrations.services.vulnerabilities.ssc.dto.IssueDetails in project octane-ci-java-sdk by MicroFocus.
the class SSCServerSimulator method setIssueDetails.
private void setIssueDetails() {
addRule("^.*/api/v1/issueDetails/.*", t -> t.getMethod().equalsIgnoreCase("get"), request -> {
try {
request.getResponse().setStatus(HttpStatus.SC_OK);
String originalURI = request.getOriginalURI();
String issueId = originalURI.substring(originalURI.lastIndexOf("/"));
IssueDetails issueDetails = new IssueDetails();
IssueDetails.IssueDetailsData issueDetailsData = new IssueDetails.IssueDetailsData();
issueDetailsData.tips = "tips:" + issueId;
issueDetailsData.recommendation = "recommendation:" + issueId;
issueDetailsData.detail = "details:" + issueId;
issueDetailsData.brief = "brief:" + issueId;
issueDetails.setData(issueDetailsData);
String json = SSCTestUtils.getJson(issueDetails);
request.getResponse().getWriter().write(json);
request.getResponse().getWriter().flush();
} catch (IOException e) {
e.printStackTrace();
}
});
}
Aggregations