use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.
the class IssueConverterTest method toModel.
@Test
void toModel() {
final IssueEntity issueEntity = getIssueEntity();
final Issue resource = IssueConverter.TO_MODEL.apply(issueEntity);
assertEquals(resource.getAutoAnalyzed(), issueEntity.getAutoAnalyzed());
assertEquals(resource.getComment(), issueEntity.getIssueDescription());
assertEquals(resource.getIgnoreAnalyzer(), issueEntity.getIgnoreAnalyzer());
assertEquals(resource.getIssueType(), issueEntity.getIssueType().getLocator());
}
use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.
the class JaskonRequiredPropertiesValidatorTest method testInnerRequiredFields2.
@Test
public void testInnerRequiredFields2() {
FinishTestItemRQ issueRQ = new FinishTestItemRQ();
issueRQ.setEndTime(Calendar.getInstance().getTime());
issueRQ.setStatus("PASSED");
issueRQ.setIssue(new Issue());
JaskonRequiredPropertiesValidator validator = new JaskonRequiredPropertiesValidator();
Errors errors = new BeanPropertyBindingResult(issueRQ, "issueRQ");
validator.validate(issueRQ, errors);
assertThat(errors.getAllErrors(), not(empty()));
}
use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.
the class FinishTestItemHandlerImpl method resolveIssue.
private Optional<IssueEntity> resolveIssue(ReportPortalUser user, StatusEnum status, TestItem testItem, @Nullable Issue issue, Long projectId) {
if (isIssueRequired(testItem, status)) {
return ofNullable(issue).map(is -> {
// in provided issue should be locator id or NOT_ISSUE value
String locator = is.getIssueType();
if (!NOT_ISSUE_FLAG.getValue().equalsIgnoreCase(locator)) {
IssueType issueType = issueTypeHandler.defineIssueType(projectId, locator);
IssueEntity issueEntity = IssueConverter.TO_ISSUE.apply(is);
issueEntity.setIssueType(issueType);
if (!CollectionUtils.isEmpty(issue.getExternalSystemIssues())) {
externalTicketHandler.linkExternalTickets(user.getUsername(), Lists.newArrayList(issueEntity), new ArrayList<>(issue.getExternalSystemIssues()));
}
return Optional.of(issueEntity);
}
return Optional.<IssueEntity>empty();
}).orElseGet(() -> {
IssueEntity issueEntity = new IssueEntity();
IssueType toInvestigate = issueTypeHandler.defineIssueType(projectId, TO_INVESTIGATE.getLocator());
issueEntity.setIssueType(toInvestigate);
return Optional.of(issueEntity);
});
}
return Optional.empty();
}
use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.
the class TestItemControllerTest method finishTestItemWithLinkedTicketsBadBtsUrl.
@Test
void finishTestItemWithLinkedTicketsBadBtsUrl() throws Exception {
FinishTestItemRQ rq = new FinishTestItemRQ();
rq.setLaunchUuid("334d153c-8f9c-4dff-8627-47dd003bee0f");
rq.setEndTime(Date.from(LocalDateTime.now().atZone(ZoneId.of("UTC")).toInstant()));
rq.setStatus("FAILED");
Issue.ExternalSystemIssue ticket = new Issue.ExternalSystemIssue();
ticket.setBtsProject("project");
ticket.setTicketId("ticket1");
ticket.setUrl("https://example.com/NEWTICKET1");
Issue issue = new Issue();
issue.setIssueType("pb001");
issue.setIgnoreAnalyzer(false);
issue.setExternalSystemIssues(Sets.newHashSet(ticket));
rq.setIssue(issue);
mockMvc.perform(put(SUPERADMIN_PROJECT_BASE_URL + "/item/3ab067e5-537b-45ff-9605-843ab695c96a").content(objectMapper.writeValueAsBytes(rq)).contentType(APPLICATION_JSON).with(token(oAuthHelper.getSuperadminToken()))).andExpect(status().isBadRequest());
}
use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.
the class TestItemControllerTest method linkExternalIssueNegative.
@Test
void linkExternalIssueNegative() throws Exception {
LinkExternalIssueRQ rq = new LinkExternalIssueRQ();
rq.setTestItemIds(Collections.singletonList(2L));
Issue.ExternalSystemIssue issue = new Issue.ExternalSystemIssue();
issue.setBtsUrl("jira.com");
issue.setBtsProject("project");
issue.setTicketId("ticket1");
issue.setUrl("https://example.com/NEWTICKET1");
rq.setIssues(Collections.singletonList(issue));
mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + "/item/issue/link").with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(rq)).contentType(APPLICATION_JSON)).andExpect(status().isBadRequest());
}
Aggregations