Search in sources :

Example 16 with ItemAttribute

use of com.epam.ta.reportportal.entity.ItemAttribute 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 17 with ItemAttribute

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

the class LaunchResourceMetadataAttributeUpdaterTest method shouldUpdateMetadataWhenAttributeMatches.

@Test
void shouldUpdateMetadataWhenAttributeMatches() {
    final LaunchResource launchResource = new LaunchResource();
    final List<ItemAttribute> attributes = List.of(new ItemAttribute(RP_CLUSTER_LAST_RUN_KEY, "v1", false), new ItemAttribute("k2", "v2", false));
    updater.handle(launchResource, attributes);
    final Map<String, Object> metadata = launchResource.getMetadata();
    Assertions.assertFalse(metadata.isEmpty());
    Assertions.assertEquals("v1", metadata.get(RP_CLUSTER_LAST_RUN_KEY));
}
Also used : ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) LaunchResource(com.epam.ta.reportportal.ws.model.launch.LaunchResource) Test(org.junit.jupiter.api.Test)

Example 18 with ItemAttribute

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

the class LaunchResourceMetadataAttributeUpdaterTest method shouldNotUpdateMetadataWhenAttributeMatches.

@Test
void shouldNotUpdateMetadataWhenAttributeMatches() {
    final LaunchResource launchResource = new LaunchResource();
    final List<ItemAttribute> attributes = List.of(new ItemAttribute("k1", "v1", false), new ItemAttribute("k2", "v2", false));
    updater.handle(launchResource, attributes);
    Assertions.assertTrue(MapUtils.isEmpty(launchResource.getMetadata()));
}
Also used : ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) LaunchResource(com.epam.ta.reportportal.ws.model.launch.LaunchResource) Test(org.junit.jupiter.api.Test)

Example 19 with ItemAttribute

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

the class PredicateItemAttributeTypeMatcherTest method systemShouldReturnTrue.

@Test
void systemShouldReturnTrue() {
    final ItemAttribute systemAttribute = new ItemAttribute("k1", "v1", true);
    Assertions.assertTrue(systemAttributeMatcher.matches(systemAttribute));
}
Also used : ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) Test(org.junit.jupiter.api.Test)

Example 20 with ItemAttribute

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

the class PredicateItemAttributeTypeMatcherTest method publicShouldReturnFalse.

@Test
void publicShouldReturnFalse() {
    final ItemAttribute systemAttribute = new ItemAttribute("k1", "v1", true);
    Assertions.assertFalse(publicAttributeMatcher.matches(systemAttribute));
}
Also used : ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) Test(org.junit.jupiter.api.Test)

Aggregations

ItemAttribute (com.epam.ta.reportportal.entity.ItemAttribute)24 Test (org.junit.jupiter.api.Test)16 Launch (com.epam.ta.reportportal.entity.launch.Launch)9 TestItem (com.epam.ta.reportportal.entity.item.TestItem)7 ItemAttributeResource (com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource)5 TestItemResults (com.epam.ta.reportportal.entity.item.TestItemResults)4 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)3 Parameter (com.epam.ta.reportportal.entity.item.Parameter)3 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)3 MessageBus (com.epam.ta.reportportal.core.events.MessageBus)2 TestItemService (com.epam.ta.reportportal.core.item.TestItemService)2 StatusChangingStrategy (com.epam.ta.reportportal.core.item.impl.status.StatusChangingStrategy)2 ProjectRepository (com.epam.ta.reportportal.dao.ProjectRepository)2 TestItemRepository (com.epam.ta.reportportal.dao.TestItemRepository)2 StatusEnum (com.epam.ta.reportportal.entity.enums.StatusEnum)2 TestItemIssueGroup (com.epam.ta.reportportal.entity.enums.TestItemIssueGroup)2 TestItemTypeEnum (com.epam.ta.reportportal.entity.enums.TestItemTypeEnum)2 IssueEntity (com.epam.ta.reportportal.entity.item.issue.IssueEntity)2 IssueType (com.epam.ta.reportportal.entity.item.issue.IssueType)2 ProjectRole (com.epam.ta.reportportal.entity.project.ProjectRole)2