use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project service-api by reportportal.
the class AbstractLaunchMergeStrategy method createResultedLaunch.
/**
* Create launch that will be the result of merge
*
* @param projectId {@link Project#getId()}
* @param userId {@link ReportPortalUser#getUserId()}
* @param mergeLaunchesRQ {@link MergeLaunchesRQ}
* @param launches {@link List} of the {@link Launch}
* @return launch
*/
private Launch createResultedLaunch(Long projectId, Long userId, MergeLaunchesRQ mergeLaunchesRQ, List<Launch> launches) {
Date startTime = ofNullable(mergeLaunchesRQ.getStartTime()).orElse(EntityUtils.TO_DATE.apply(launches.stream().min(Comparator.comparing(Launch::getStartTime)).orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR, "Invalid launches")).getStartTime()));
Date endTime = ofNullable(mergeLaunchesRQ.getEndTime()).orElse(EntityUtils.TO_DATE.apply(launches.stream().max(Comparator.comparing(Launch::getEndTime)).orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR, "Invalid launches")).getEndTime()));
expect(endTime, time -> !time.before(startTime)).verify(FINISH_TIME_EARLIER_THAN_START_TIME, TO_LOCAL_DATE_TIME.apply(endTime), startTime, projectId);
StartLaunchRQ startRQ = new StartLaunchRQ();
startRQ.setMode(ofNullable(mergeLaunchesRQ.getMode()).orElse(Mode.DEFAULT));
startRQ.setDescription(ofNullable(mergeLaunchesRQ.getDescription()).orElse(launches.stream().map(Launch::getDescription).collect(joining("\n\n"))));
startRQ.setName(ofNullable(mergeLaunchesRQ.getName()).orElse("Merged: " + launches.stream().map(Launch::getName).distinct().collect(joining(", "))));
startRQ.setStartTime(startTime);
Launch launch = new LaunchBuilder().addStartRQ(startRQ).addProject(projectId).addStatus(IN_PROGRESS.name()).addUserId(userId).addEndTime(endTime).get();
launch.setHasRetries(launches.stream().anyMatch(Launch::isHasRetries));
launchRepository.save(launch);
launchRepository.refresh(launch);
mergeAttributes(mergeLaunchesRQ.getAttributes(), launches, launch);
return launch;
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project service-api by reportportal.
the class AbstractImportStrategy method startLaunch.
protected String startLaunch(ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user, String launchName) {
StartLaunchRQ startLaunchRQ = new StartLaunchRQ();
startLaunchRQ.setStartTime(initialStartTime);
startLaunchRQ.setName(launchName);
startLaunchRQ.setMode(Mode.DEFAULT);
return startLaunchHandler.startLaunch(user, projectDetails, startLaunchRQ).getId();
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project agent-java-junit5 by reportportal.
the class ReportPortalExtension method buildStartLaunchRq.
/**
* Extension point to customize launch creation event/request
*
* @param parameters Launch Configuration parameters
* @return Request to ReportPortal
*/
protected StartLaunchRQ buildStartLaunchRq(ListenerParameters parameters) {
StartLaunchRQ rq = new StartLaunchRQ();
rq.setMode(parameters.getLaunchRunningMode());
rq.setDescription(parameters.getDescription());
rq.setName(parameters.getLaunchName());
Set<ItemAttributesRQ> attributes = new HashSet<>(parameters.getAttributes());
attributes.addAll(collectSystemAttributes(parameters.getSkippedAnIssue()));
rq.setAttributes(attributes);
rq.setStartTime(Calendar.getInstance().getTime());
rq.setRerun(parameters.isRerun());
rq.setRerunOf(StringUtils.isEmpty(parameters.getRerunOf()) ? null : parameters.getRerunOf());
return rq;
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project agent-java-soapui by reportportal.
the class StepBasedSoapUIServiceImpl method startLaunch.
public void startLaunch() {
StartLaunchRQ rq = new StartLaunchRQ();
rq.setName(this.parameters.getLaunchName());
rq.setStartTime(Calendar.getInstance().getTime());
rq.setTags(parameters.getTags());
rq.setMode(parameters.getLaunchRunningMode());
rq.setDescription(parameters.getDescription());
this.reportPortal = ReportPortal.builder().withParameters(parameters).build();
this.launch = reportPortal.newLaunch(rq);
context.setLaunchFailed(false);
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project seleniumRobot by bhecquet.
the class ReportPortalService method buildStartLaunch.
private static StartLaunchRQ buildStartLaunch(ListenerParameters parameters) {
StartLaunchRQ rq = new StartLaunchRQ();
rq.setName(parameters.getLaunchName());
rq.setStartTime(Calendar.getInstance().getTime());
rq.setAttributes(parameters.getAttributes());
rq.setMode(parameters.getLaunchRunningMode());
if (!Strings.isNullOrEmpty(parameters.getDescription())) {
rq.setDescription(parameters.getDescription());
}
return rq;
}
Aggregations