Search in sources :

Example 1 with Ticket

use of com.epam.ta.reportportal.entity.bts.Ticket in project service-api by reportportal.

the class TestItemConverterTest method getItem.

private TestItem getItem(boolean hasIssue) {
    TestItem item = new TestItem();
    item.setName("name");
    item.setDescription("description");
    item.setStartTime(LocalDateTime.now());
    item.setUniqueId("uniqueId");
    item.setUuid("uuid");
    item.setItemId(1L);
    item.setType(TestItemTypeEnum.STEP);
    item.setPath("1.2.3");
    final Parameter parameter = new Parameter();
    parameter.setKey("key");
    parameter.setValue("value");
    item.setParameters(Sets.newHashSet(parameter));
    item.setAttributes(Sets.newHashSet(new ItemAttribute("key1", "value1", false), new ItemAttribute("key2", "value2", false)));
    final Launch launch = new Launch();
    launch.setProjectId(4L);
    launch.setId(2L);
    item.setLaunchId(launch.getId());
    item.setHasChildren(false);
    final TestItem parent = new TestItem();
    parent.setItemId(3L);
    item.setParentId(parent.getItemId());
    final TestItemResults itemResults = new TestItemResults();
    itemResults.setStatus(StatusEnum.FAILED);
    itemResults.setEndTime(LocalDateTime.now());
    if (hasIssue) {
        final IssueEntity issue = new IssueEntity();
        issue.setIssueId(3L);
        issue.setIssueType(new IssueType(new IssueGroup(TestItemIssueGroup.PRODUCT_BUG), "locator", "long name", "SNA", "color"));
        issue.setIgnoreAnalyzer(false);
        issue.setAutoAnalyzed(false);
        issue.setIssueDescription("issue description");
        final Ticket ticket = new Ticket();
        ticket.setTicketId("ticketId1");
        ticket.setUrl("http:/example.com/ticketId1");
        final Ticket ticket1 = new Ticket();
        ticket1.setTicketId("ticketId2");
        ticket1.setUrl("http:/example.com/ticketId2");
        issue.setTickets(Sets.newHashSet(ticket, ticket1));
        itemResults.setIssue(issue);
    }
    itemResults.setStatistics(Sets.newHashSet(new Statistics(new StatisticsField("statistics$defects$automation_bug$total"), 1, 2L)));
    item.setItemResults(itemResults);
    return item;
}
Also used : TestItemIssueGroup(com.epam.ta.reportportal.entity.enums.TestItemIssueGroup) IssueGroup(com.epam.ta.reportportal.entity.item.issue.IssueGroup) Ticket(com.epam.ta.reportportal.entity.bts.Ticket) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) StatisticsField(com.epam.ta.reportportal.entity.statistics.StatisticsField) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) Parameter(com.epam.ta.reportportal.entity.item.Parameter) ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) Launch(com.epam.ta.reportportal.entity.launch.Launch) TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) Statistics(com.epam.ta.reportportal.entity.statistics.Statistics) TestItem(com.epam.ta.reportportal.entity.item.TestItem)

Example 2 with Ticket

use of com.epam.ta.reportportal.entity.bts.Ticket in project service-api by reportportal.

the class TicketConverterTest method toTicket.

@Test
void toTicket() {
    final Issue.ExternalSystemIssue issue = getIssue();
    final Ticket resource = TicketConverter.TO_TICKET.apply(issue);
    assertEquals(resource.getTicketId(), issue.getTicketId());
    assertEquals(resource.getUrl(), issue.getUrl());
    assertEquals(resource.getBtsUrl(), issue.getBtsUrl());
    assertEquals(resource.getBtsProject(), issue.getBtsProject());
}
Also used : Ticket(com.epam.ta.reportportal.entity.bts.Ticket) Issue(com.epam.ta.reportportal.ws.model.issue.Issue) Test(org.junit.jupiter.api.Test)

Aggregations

Ticket (com.epam.ta.reportportal.entity.bts.Ticket)2 ItemAttribute (com.epam.ta.reportportal.entity.ItemAttribute)1 TestItemIssueGroup (com.epam.ta.reportportal.entity.enums.TestItemIssueGroup)1 Parameter (com.epam.ta.reportportal.entity.item.Parameter)1 TestItem (com.epam.ta.reportportal.entity.item.TestItem)1 TestItemResults (com.epam.ta.reportportal.entity.item.TestItemResults)1 IssueEntity (com.epam.ta.reportportal.entity.item.issue.IssueEntity)1 IssueGroup (com.epam.ta.reportportal.entity.item.issue.IssueGroup)1 IssueType (com.epam.ta.reportportal.entity.item.issue.IssueType)1 Launch (com.epam.ta.reportportal.entity.launch.Launch)1 Statistics (com.epam.ta.reportportal.entity.statistics.Statistics)1 StatisticsField (com.epam.ta.reportportal.entity.statistics.StatisticsField)1 Issue (com.epam.ta.reportportal.ws.model.issue.Issue)1 Test (org.junit.jupiter.api.Test)1