Search in sources :

Example 6 with ItemAttribute

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

the class FinishLaunchHierarchyHandlerTest method finishWithSkippedStatus.

@Test
void finishWithSkippedStatus() {
    Launch launch = getLaunch();
    when(itemAttributeRepository.findByLaunchIdAndKeyAndSystem(launch.getId(), SKIPPED_ISSUE_KEY, true)).thenReturn(java.util.Optional.of(new ItemAttribute(SKIPPED_ISSUE_KEY, "true", true)));
    when(issueTypeHandler.defineIssueType(anyLong(), anyString())).thenReturn(getToInvestigateIssueType());
    List<Long> idsWithChildren = Lists.newArrayList(2L, 1L);
    List<Long> idsWithoutChildren = Lists.newArrayList(3L, 4L);
    when(testItemRepository.findIdsByHasChildrenAndLaunchIdAndStatusOrderedByPathLevel(eq(launch.getId()), eq(StatusEnum.IN_PROGRESS), anyInt(), anyLong())).thenReturn(idsWithChildren);
    when(testItemRepository.findIdsByNotHasChildrenAndLaunchIdAndStatus(eq(launch.getId()), eq(StatusEnum.IN_PROGRESS), anyInt(), anyLong())).thenReturn(idsWithoutChildren);
    Date endTime = Date.from(LocalDate.of(2020, Month.OCTOBER, 30).atStartOfDay(ZoneId.systemDefault()).toInstant());
    ReportPortalUser rpUser = getRpUser("test", UserRole.USER, ProjectRole.MEMBER, 1L);
    when(testItemRepository.findAllById(idsWithChildren)).thenReturn(getTestItemsWithChildren(launch));
    when(testItemRepository.findAllById(idsWithoutChildren)).thenReturn(getTestItemsWithoutChildren(launch));
    finishLaunchHierarchyHandler.finishDescendants(launch, StatusEnum.SKIPPED, endTime, rpUser, rpUser.getProjectDetails().get(TEST_PROJECT_NAME));
    verify(changeStatusHandler, times(2)).changeParentStatus(any(TestItem.class), any(), any());
    verify(issueEntityRepository, times(2)).save(any());
}
Also used : ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) Launch(com.epam.ta.reportportal.entity.launch.Launch) Date(java.util.Date) LocalDate(java.time.LocalDate) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Example 7 with ItemAttribute

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

the class ClusterItemDataProviderMockTest method getTestItem.

private TestItem getTestItem(int index) {
    final TestItem testItem = new TestItem();
    testItem.setItemId((long) index);
    testItem.setUuid(String.valueOf(index));
    testItem.setUniqueId(String.valueOf(index));
    testItem.setTestCaseId(String.valueOf(index));
    testItem.setTestCaseHash(index);
    testItem.setName("name " + index);
    testItem.setCodeRef("ref" + index);
    testItem.setDescription("description " + index);
    testItem.setHasChildren(false);
    testItem.setType(TestItemTypeEnum.STEP);
    testItem.setHasRetries(false);
    testItem.setHasStats(true);
    testItem.setLastModified(LocalDateTime.now(ZoneOffset.UTC));
    testItem.setPath(String.valueOf(index));
    testItem.setStartTime(LocalDateTime.now(ZoneOffset.UTC));
    final Set<Parameter> parameters = getParameters(index);
    testItem.setParameters(parameters);
    final Set<ItemAttribute> attributes = getItemAttributes(index);
    testItem.setAttributes(attributes);
    final TestItemResults testItemResults = getTestItemResults((long) index);
    testItem.setItemResults(testItemResults);
    return testItem;
}
Also used : Parameter(com.epam.ta.reportportal.entity.item.Parameter) ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) TestItem(com.epam.ta.reportportal.entity.item.TestItem)

Example 8 with ItemAttribute

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

the class ClusterItemDataProviderMockTest method getItemAttributes.

private Set<ItemAttribute> getItemAttributes(int index) {
    final ItemAttribute itemAttribute = new ItemAttribute();
    itemAttribute.setKey("key" + index);
    itemAttribute.setValue("value" + index);
    itemAttribute.setSystem(false);
    return Set.of(itemAttribute);
}
Also used : ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute)

Example 9 with ItemAttribute

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

the class SaveLastRunAttributePartProviderTest method shouldUpdateWhenExists.

@Test
void shouldUpdateWhenExists() {
    final GenerateClustersConfig config = getConfig(false);
    final ItemAttribute itemAttribute = new ItemAttribute();
    when(itemAttributeRepository.findByLaunchIdAndKeyAndSystem(config.getLaunchId(), RP_CLUSTER_LAST_RUN_KEY, true)).thenReturn(Optional.of(itemAttribute));
    final PipelinePart pipelinePart = provider.provide(config);
    pipelinePart.handle();
    verify(itemAttributeRepository, times(1)).save(itemAttribute);
}
Also used : ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) PipelinePart(com.epam.ta.reportportal.pipeline.PipelinePart) GenerateClustersConfig(com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig) Test(org.junit.jupiter.api.Test)

Example 10 with ItemAttribute

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

the class EmailServiceTest method getLaunch.

private Launch getLaunch() {
    Launch launch = new Launch();
    launch.setId(1L);
    launch.setHasRetries(false);
    launch.setStatus(StatusEnum.PASSED);
    launch.setProjectId(1L);
    launch.setStartTime(LocalDateTime.now());
    launch.setEndTime(LocalDateTime.now().plusMinutes(5L));
    launch.setName("Launch name");
    launch.setMode(LaunchModeEnum.DEFAULT);
    launch.setNumber(1L);
    launch.setDescription("description");
    launch.setAttributes(Sets.newHashSet(new ItemAttribute("key", "value", false)));
    StatisticsField statisticsField = new StatisticsField("statistics$executions$total");
    Statistics statistics = new Statistics(statisticsField, 1, 1L);
    launch.setStatistics(Sets.newHashSet(statistics));
    return launch;
}
Also used : StatisticsField(com.epam.ta.reportportal.entity.statistics.StatisticsField) ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) Launch(com.epam.ta.reportportal.entity.launch.Launch) Statistics(com.epam.ta.reportportal.entity.statistics.Statistics)

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