Search in sources :

Example 1 with Issue

use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.

the class TestItemControllerTest method finishTestItemWithEmptyLinkedTickets.

@Test
void finishTestItemWithEmptyLinkedTickets() 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 issue = new Issue();
    issue.setIssueType("pb001");
    issue.setIgnoreAnalyzer(false);
    issue.setExternalSystemIssues(Sets.newHashSet());
    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().isOk());
}
Also used : Issue(com.epam.ta.reportportal.ws.model.issue.Issue) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 2 with Issue

use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.

the class TestItemControllerTest method defineTestItemIssue.

@Test
void defineTestItemIssue() throws Exception {
    DefineIssueRQ rq = new DefineIssueRQ();
    IssueDefinition issueDefinition = new IssueDefinition();
    issueDefinition.setId(3L);
    Issue issue = new Issue();
    issue.setIssueType("pb001");
    issue.setIgnoreAnalyzer(false);
    issueDefinition.setIssue(issue);
    rq.setIssues(Collections.singletonList(issueDefinition));
    mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + "/item").with(token(oAuthHelper.getDefaultToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(rq))).andExpect(status().isOk());
}
Also used : Issue(com.epam.ta.reportportal.ws.model.issue.Issue) IssueDefinition(com.epam.ta.reportportal.ws.model.issue.IssueDefinition) DefineIssueRQ(com.epam.ta.reportportal.ws.model.issue.DefineIssueRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 3 with Issue

use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.

the class TestItemControllerTest method linkExternalIssues.

@Test
void linkExternalIssues() throws Exception {
    LinkExternalIssueRQ rq = new LinkExternalIssueRQ();
    rq.setTestItemIds(Collections.singletonList(3L));
    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().isOk());
}
Also used : LinkExternalIssueRQ(com.epam.ta.reportportal.ws.model.item.LinkExternalIssueRQ) Issue(com.epam.ta.reportportal.ws.model.issue.Issue) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 4 with Issue

use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.

the class TestItemControllerTest method finishTestItemWithFailedStatus.

@Test
void finishTestItemWithFailedStatus() throws Exception {
    FinishTestItemRQ rq = new FinishTestItemRQ();
    rq.setLaunchUuid(UUID.randomUUID().toString());
    rq.setEndTime(Date.from(LocalDateTime.now().atZone(ZoneId.of("UTC")).toInstant()));
    rq.setStatus("FAILED");
    Issue issue = new Issue();
    issue.setIssueType("pb001");
    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().isOk());
}
Also used : Issue(com.epam.ta.reportportal.ws.model.issue.Issue) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 5 with Issue

use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.

the class TestItemControllerTest method finishTestItemWithFinishedParent.

@Sql("/db/test-item/item-change-status-from-passed.sql")
@Test
void finishTestItemWithFinishedParent() throws Exception {
    FinishTestItemRQ rq = new FinishTestItemRQ();
    rq.setLaunchUuid(UUID.randomUUID().toString());
    rq.setEndTime(Date.from(LocalDateTime.now().atZone(ZoneId.of("UTC")).toInstant()));
    rq.setStatus("FAILED");
    Issue issue = new Issue();
    issue.setIssueType("pb001");
    rq.setIssue(issue);
    Optional<TestItem> updatedItem = testItemRepository.findById(11L);
    assertTrue(updatedItem.isPresent());
    assertEquals(StatusEnum.IN_PROGRESS, updatedItem.get().getItemResults().getStatus());
    mockMvc.perform(put(SUPERADMIN_PROJECT_BASE_URL + "/item/uuid_s_2_9").content(objectMapper.writeValueAsBytes(rq)).contentType(APPLICATION_JSON).with(token(oAuthHelper.getSuperadminToken()))).andExpect(status().isOk());
    updatedItem = testItemRepository.findById(11L);
    assertTrue(updatedItem.isPresent());
    assertEquals(StatusEnum.FAILED, updatedItem.get().getItemResults().getStatus());
    assertEquals(TestItemIssueGroup.PRODUCT_BUG, updatedItem.get().getItemResults().getIssue().getIssueType().getIssueGroup().getTestItemIssueGroup());
    assertEquals(StatusEnum.FAILED, testItemRepository.findById(updatedItem.get().getParentId()).get().getItemResults().getStatus());
    Launch launch = launchRepository.findById(updatedItem.get().getLaunchId()).get();
    assertEquals(StatusEnum.FAILED, launch.getStatus());
}
Also used : Issue(com.epam.ta.reportportal.ws.model.issue.Issue) Launch(com.epam.ta.reportportal.entity.launch.Launch) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) TestItem(com.epam.ta.reportportal.entity.item.TestItem) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test) Sql(org.springframework.test.context.jdbc.Sql)

Aggregations

Issue (com.epam.ta.reportportal.ws.model.issue.Issue)23 Test (org.junit.jupiter.api.Test)19 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)15 FinishTestItemRQ (com.epam.ta.reportportal.ws.model.FinishTestItemRQ)10 IssueEntity (com.epam.ta.reportportal.entity.item.issue.IssueEntity)4 LinkExternalIssueRQ (com.epam.ta.reportportal.ws.model.item.LinkExternalIssueRQ)4 TestItem (com.epam.ta.reportportal.entity.item.TestItem)3 IssueDefinition (com.epam.ta.reportportal.ws.model.issue.IssueDefinition)3 IssueType (com.epam.ta.reportportal.entity.item.issue.IssueType)2 Launch (com.epam.ta.reportportal.entity.launch.Launch)2 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)2 ErrorRS (com.epam.ta.reportportal.ws.model.ErrorRS)2 DefineIssueRQ (com.epam.ta.reportportal.ws.model.issue.DefineIssueRQ)2 MvcResult (org.springframework.test.web.servlet.MvcResult)2 TO_LOCAL_DATE_TIME (com.epam.ta.reportportal.commons.EntityUtils.TO_LOCAL_DATE_TIME)1 Preconditions (com.epam.ta.reportportal.commons.Preconditions)1 Predicates.equalTo (com.epam.ta.reportportal.commons.Predicates.equalTo)1 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)1 BusinessRule.expect (com.epam.ta.reportportal.commons.validation.BusinessRule.expect)1 BusinessRuleViolationException (com.epam.ta.reportportal.commons.validation.BusinessRuleViolationException)1