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());
}
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;
}
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);
}
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);
}
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;
}
Aggregations