Search in sources :

Example 1 with PROJECT_NOT_FOUND

use of com.epam.ta.reportportal.ws.model.ErrorType.PROJECT_NOT_FOUND in project service-api by reportportal.

the class AbstractStatusChangingStrategy method changeStatus.

@Override
public void changeStatus(TestItem testItem, StatusEnum providedStatus, ReportPortalUser user) {
    BusinessRule.expect(testItem.getItemResults().getStatus(), currentStatus -> !IN_PROGRESS.equals(currentStatus)).verify(INCORRECT_REQUEST, Suppliers.formattedSupplier("Unable to update status of test item = '{}' because of '{}' status", testItem.getItemId(), testItem.getItemResults().getStatus()).get());
    if (providedStatus == testItem.getItemResults().getStatus()) {
        return;
    }
    Launch launch = testItemService.getEffectiveLaunch(testItem);
    Project project = projectRepository.findById(launch.getProjectId()).orElseThrow(() -> new ReportPortalException(PROJECT_NOT_FOUND, launch.getProjectId()));
    updateStatus(project, launch, testItem, providedStatus, user);
}
Also used : StatusEnum(com.epam.ta.reportportal.entity.enums.StatusEnum) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) Project(com.epam.ta.reportportal.entity.project.Project) IssueTypeHandler(com.epam.ta.reportportal.core.item.impl.IssueTypeHandler) TestItemService(com.epam.ta.reportportal.core.item.TestItemService) TestItem(com.epam.ta.reportportal.entity.item.TestItem) ErrorType(com.epam.ta.reportportal.ws.model.ErrorType) MessageBus(com.epam.ta.reportportal.core.events.MessageBus) Lists(com.google.common.collect.Lists) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) PROJECT_NOT_FOUND(com.epam.ta.reportportal.ws.model.ErrorType.PROJECT_NOT_FOUND) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) INCORRECT_REQUEST(com.epam.ta.reportportal.ws.model.ErrorType.INCORRECT_REQUEST) TO_INVESTIGATE(com.epam.ta.reportportal.entity.enums.TestItemIssueGroup.TO_INVESTIGATE) BusinessRule(com.epam.ta.reportportal.commons.validation.BusinessRule) TestItemActivityResource(com.epam.ta.reportportal.ws.model.activity.TestItemActivityResource) Launch(com.epam.ta.reportportal.entity.launch.Launch) LogIndexer(com.epam.ta.reportportal.core.analyzer.auto.LogIndexer) TestItemStatusChangedEvent(com.epam.ta.reportportal.core.events.activity.TestItemStatusChangedEvent) Optional.ofNullable(java.util.Optional.ofNullable) com.epam.ta.reportportal.dao(com.epam.ta.reportportal.dao) TO_ACTIVITY_RESOURCE(com.epam.ta.reportportal.ws.converter.converters.TestItemConverter.TO_ACTIVITY_RESOURCE) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) List(java.util.List) Optional(java.util.Optional) Suppliers(com.epam.ta.reportportal.commons.validation.Suppliers) Collections(java.util.Collections) Project(com.epam.ta.reportportal.entity.project.Project) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) Launch(com.epam.ta.reportportal.entity.launch.Launch)

Aggregations

ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)1 BusinessRule (com.epam.ta.reportportal.commons.validation.BusinessRule)1 Suppliers (com.epam.ta.reportportal.commons.validation.Suppliers)1 LogIndexer (com.epam.ta.reportportal.core.analyzer.auto.LogIndexer)1 MessageBus (com.epam.ta.reportportal.core.events.MessageBus)1 TestItemStatusChangedEvent (com.epam.ta.reportportal.core.events.activity.TestItemStatusChangedEvent)1 TestItemService (com.epam.ta.reportportal.core.item.TestItemService)1 IssueTypeHandler (com.epam.ta.reportportal.core.item.impl.IssueTypeHandler)1 com.epam.ta.reportportal.dao (com.epam.ta.reportportal.dao)1 StatusEnum (com.epam.ta.reportportal.entity.enums.StatusEnum)1 TO_INVESTIGATE (com.epam.ta.reportportal.entity.enums.TestItemIssueGroup.TO_INVESTIGATE)1 TestItem (com.epam.ta.reportportal.entity.item.TestItem)1 IssueEntity (com.epam.ta.reportportal.entity.item.issue.IssueEntity)1 IssueType (com.epam.ta.reportportal.entity.item.issue.IssueType)1 Launch (com.epam.ta.reportportal.entity.launch.Launch)1 Project (com.epam.ta.reportportal.entity.project.Project)1 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)1 TO_ACTIVITY_RESOURCE (com.epam.ta.reportportal.ws.converter.converters.TestItemConverter.TO_ACTIVITY_RESOURCE)1 ErrorType (com.epam.ta.reportportal.ws.model.ErrorType)1 INCORRECT_REQUEST (com.epam.ta.reportportal.ws.model.ErrorType.INCORRECT_REQUEST)1