use of com.epam.ta.reportportal.ws.model.externalsystem.Ticket in project service-api by reportportal.
the class CreateTicketHandlerImpl method createIssue.
@Override
public Ticket createIssue(PostTicketRQ postTicketRQ, Long integrationId, ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user) {
validatePostTicketRQ(postTicketRQ);
List<TestItem> testItems = ofNullable(postTicketRQ.getBackLinks()).map(links -> testItemRepository.findAllById(links.keySet())).orElseGet(Collections::emptyList);
List<TestItemActivityResource> before = testItems.stream().map(it -> TO_ACTIVITY_RESOURCE.apply(it, projectDetails.getProjectId())).collect(Collectors.toList());
Integration integration = getIntegrationHandler.getEnabledBtsIntegration(projectDetails, integrationId);
expect(BtsConstants.DEFECT_FORM_FIELDS.getParam(integration.getParams()), notNull()).verify(BAD_REQUEST_ERROR, "There aren't any submitted BTS fields!");
BtsExtension btsExtension = pluginBox.getInstance(integration.getType().getName(), BtsExtension.class).orElseThrow(() -> new ReportPortalException(BAD_REQUEST_ERROR, Suppliers.formattedSupplier("BugTracking plugin for {} isn't installed", BtsConstants.PROJECT.getParam(integration.getParams())).get()));
Ticket ticket = btsExtension.submitTicket(postTicketRQ, integration);
before.forEach(it -> messageBus.publishActivity(new TicketPostedEvent(ticket, user.getUserId(), user.getUsername(), it)));
return ticket;
}
use of com.epam.ta.reportportal.ws.model.externalsystem.Ticket in project service-api by reportportal.
the class TicketPostedEventTest method getTicket.
private static Ticket getTicket() {
Ticket ticket = new Ticket();
ticket.setId(TicketPostedEventTest.NEW_TICKET_ID);
ticket.setTicketUrl(TicketPostedEventTest.NEW_TICKET_URL);
ticket.setStatus("status");
ticket.setSummary("summary");
return ticket;
}
Aggregations