use of com.hp.octane.integrations.dto.securityscans.OctaneIssue in project octane-ci-java-sdk by MicroFocus.
the class IssuesValidate method getOctaneIssuesPushed.
private OctaneIssuesPushed getOctaneIssuesPushed(String output) throws IOException {
OctaneIssuesPushed octaneIssuesPushed = null;
try {
ObjectMapper objectMapper = new ObjectMapper();
RawPushedIssues rawPushedIssues = objectMapper.readValue(output, RawPushedIssues.class);
StringWriter stringWriter = new StringWriter();
objectMapper.writeValue(stringWriter, rawPushedIssues.data);
stringWriter.flush();
String issuesArrayAsString = stringWriter.toString();
OctaneIssue[] octaneIssuesArray = DTOFactory.getInstance().dtoCollectionFromJson(issuesArrayAsString, OctaneIssue[].class);
octaneIssuesPushed = new OctaneIssuesPushed();
octaneIssuesPushed.octaneIssues = Arrays.asList(octaneIssuesArray);
} catch (IOException e) {
e.printStackTrace();
throw e;
}
return octaneIssuesPushed;
}
use of com.hp.octane.integrations.dto.securityscans.OctaneIssue 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.dto.securityscans.OctaneIssue in project octane-ci-java-sdk by MicroFocus.
the class PackIssuesToSendToOctaneTest method packSomeToCloseAndSomeToNewAndUpdate.
@Test
public void packSomeToCloseAndSomeToNewAndUpdate() throws IOException {
List<String> existingInOctane = Arrays.asList("XYZ", "LMNO", "RemoteId2");
Issues issues = sscIssuesToPack();
PackIssuesToOctaneUtils.SortedIssues<Issues.Issue> issueSortedIssues = PackIssuesToOctaneUtils.packToOctaneIssues(issues.getData(), existingInOctane, true);
List<OctaneIssue> octaneIssues = createOctaneIssues(issueSortedIssues.issuesToUpdate, "Tag", new HashMap<>());
Assert.assertEquals(2, octaneIssues.size());
Assert.assertEquals(2, issueSortedIssues.issuesToClose.size());
validateIssueMap(octaneIssues.get(0), "list_node.issue_state_node.new", "\\ABC\\DEF\\GHIJ.java", "1", "Kingdom1", "Issue1");
validateIssueMap(octaneIssues.get(1), "list_node.issue_state_node.existing", "\\ABC\\DEF\\GHIJ\\KLM.java", "2", "Kingdom2", "Issue2");
validateIssueMap(issueSortedIssues.issuesToClose.get(0), "list_node.issue_state_node.closed", null, "-1", null, null);
Assert.assertEquals(issueSortedIssues.issuesToClose.get(0).getRemoteId(), "XYZ");
validateIssueMap(issueSortedIssues.issuesToClose.get(1), "list_node.issue_state_node.closed", null, "-1", null, null);
Assert.assertEquals(issueSortedIssues.issuesToClose.get(1).getRemoteId(), "LMNO");
}
use of com.hp.octane.integrations.dto.securityscans.OctaneIssue in project octane-ci-java-sdk by MicroFocus.
the class VulnerabilitiesTests method simpleFields.
@Test
public void simpleFields() {
Issues.Issue issue = new Issues.Issue();
issue.fullFileName = "fullFileName";
issue.lineNumber = 100;
issue.issueInstanceId = "ID_ID_ID";
issue.foundDate = "2018-09-12T14:01:20.590+0000";
issue.hRef = "hRef";
Issues sscIssues = new Issues();
sscIssues.setData(Arrays.asList(issue));
SSCHandler sscHandler = new SSCHandler();
List<OctaneIssue> octaneIssues = createOctaneIssues(sscIssues.getData(), "Tag", new HashMap<>());
Assert.assertEquals(octaneIssues.get(0).getPrimaryLocationFull(), "fullFileName");
Assert.assertEquals(String.valueOf(octaneIssues.get(0).getLine()), String.valueOf(100));
Assert.assertEquals(octaneIssues.get(0).getRemoteId(), "ID_ID_ID");
Assert.assertNotNull(octaneIssues.get(0).getIntroducedDate());
Assert.assertEquals(octaneIssues.get(0).getExternalLink(), "hRef");
}
use of com.hp.octane.integrations.dto.securityscans.OctaneIssue in project octane-ci-java-sdk by MicroFocus.
the class VulnerabilitiesTests method extendedData.
@Test
public void extendedData() {
Issues.Issue issue = new Issues.Issue();
issue.issueName = "name";
issue.likelihood = "likelihood";
issue.impact = "impact";
issue.kingdom = "kingdom";
issue.confidance = "confidence";
issue.removedDate = "removedDate";
Issues sscIssues = new Issues();
sscIssues.setData(Arrays.asList(issue));
SSCHandler sscHandler = new SSCHandler();
List<OctaneIssue> octaneIssues = createOctaneIssues(sscIssues.getData(), "Tag", new HashMap<>());
Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("issueName"), "name");
Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("likelihood"), "likelihood");
Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("kingdom"), "kingdom");
Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("impact"), "impact");
Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("confidence"), "confidence");
Assert.assertEquals(octaneIssues.get(0).getExtendedData().get("removedDate"), "removedDate");
}
Aggregations