use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project service-api by reportportal.
the class LaunchControllerValidationTest method prepareLaunch.
private StartLaunchRQ prepareLaunch() {
StartLaunchRQ startLaunchRQ = new StartLaunchRQ();
startLaunchRQ.setDescription("some description");
startLaunchRQ.setStartTime(new Date());
startLaunchRQ.setMode(DEFAULT);
startLaunchRQ.setAttributes(Sets.newHashSet(new ItemAttributesRQ("key", "value")));
return startLaunchRQ;
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project service-api by reportportal.
the class DemoDataLaunchService method startLaunch.
@Transactional
public Launch startLaunch(String name, User user, ReportPortalUser.ProjectDetails projectDetails) {
StartLaunchRQ rq = new StartLaunchRQ();
rq.setMode(Mode.DEFAULT);
rq.setDescription(ContentUtils.getLaunchDescription());
LocalDateTime now = LocalDateTime.now();
rq.setName(name);
rq.setStartTime(Date.from(now.atZone(ZoneId.systemDefault()).toInstant()));
rq.setUuid(UUID.randomUUID().toString());
Set<ItemAttributesRQ> attributes = Sets.newHashSet(new ItemAttributesRQ("platform", platformValues[new Random().nextInt(platformValues.length)]), new ItemAttributesRQ(null, "demo"), new ItemAttributesRQ("build", "3." + now.getDayOfMonth() + "." + now.getHour() + "." + now.getMinute() + "." + now.getSecond()));
Launch launch = new LaunchBuilder().addStartRQ(rq).addAttributes(attributes).addProject(projectDetails.getProjectId()).get();
launch.setUserId(user.getId());
launchRepository.save(launch);
launchRepository.refresh(launch);
return launch;
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project examples-java by reportportal.
the class SaucelabsAttributeTest method addSaucelabsAttribute.
private static void addSaucelabsAttribute() {
FinishTestItemRQ request = new FinishTestItemRQ();
request.setEndTime(Calendar.getInstance().getTime());
request.setStatus("PASSED");
request.setAttributes(Sets.newHashSet(new ItemAttributesRQ("SLID", "0586c1c90fcd4a499591109692426d54")));
ItemTreeReporter.finishItem(ReportPortalListener.getReportPortal().getClient(), request, ParallelRunningContext.getCurrent().getItemTree().getLaunchId(), testItemLeaves.get(0)).cache().ignoreElement().blockingAwait();
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project examples-java by reportportal.
the class SaucelabsAttributeTest method addSaucelabsAttribute.
private static void addSaucelabsAttribute(TestItemTree.TestItemLeaf leaf) {
FinishTestItemRQ request = new FinishTestItemRQ();
request.setStatus("passed");
request.setEndTime(Calendar.getInstance().getTime());
request.setAttributes(Sets.newHashSet(new ItemAttributesRQ("SLID", "0586c1c90fcd4a499591109692426d54")));
ItemTreeReporter.finishItem(REPORT_PORTAL.getClient(), request, TEST_ITEM_TREE.getLaunchId(), leaf).cache().subscribe();
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project agent-java-junit5 by reportportal.
the class ReportPortalExtension method buildStartConfigurationRq.
/**
* Extension point to customize beforeXXX creation event/request
*
* @param method JUnit's test method reference
* @param parentContext JUnit's context of a parent item
* @param context JUnit's test context
* @param itemType a type of the item to build
* @return Request to ReportPortal
*/
@Nonnull
protected StartTestItemRQ buildStartConfigurationRq(@Nonnull Method method, @Nonnull ExtensionContext parentContext, @Nonnull ExtensionContext context, @Nonnull ItemType itemType) {
StartTestItemRQ rq = new StartTestItemRQ();
rq.setStartTime(Calendar.getInstance().getTime());
Optional<Class<?>> testClass = context.getTestClass();
if (testClass.isPresent()) {
rq.setName(createConfigurationName(testClass.get(), method));
rq.setDescription(createConfigurationDescription(testClass.get(), method));
} else {
rq.setName(createConfigurationName(method.getDeclaringClass(), method));
rq.setDescription(createConfigurationDescription(method.getDeclaringClass(), method));
}
String uniqueId = parentContext.getUniqueId() + "/[method:" + method.getName() + "()]";
rq.setUniqueId(uniqueId);
ofNullable(context.getTags()).ifPresent(it -> rq.setAttributes(it.stream().map(tag -> new ItemAttributesRQ(null, tag)).collect(Collectors.toSet())));
rq.setType(itemType.name());
rq.setRetry(false);
String codeRef = method.getDeclaringClass().getCanonicalName() + "." + method.getName();
rq.setCodeRef(codeRef);
TestCaseIdEntry caseId = ofNullable(method.getAnnotation(TestCaseId.class)).map(TestCaseId::value).map(TestCaseIdEntry::new).orElseGet(() -> TestCaseIdUtils.getTestCaseId(codeRef, Collections.emptyList()));
rq.setTestCaseId(ofNullable(caseId).map(TestCaseIdEntry::getId).orElse(null));
return rq;
}
Aggregations