use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project agent-java-testNG by reportportal.
the class TestUtils method launchRQ.
public static StartLaunchRQ launchRQ(ListenerParameters parameters) {
StartLaunchRQ result = new StartLaunchRQ();
result.setName(parameters.getLaunchName());
result.setStartTime(Calendar.getInstance().getTime());
result.setMode(parameters.getLaunchRunningMode());
return result;
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project examples-java by reportportal.
the class CustomAttributeReporter method buildStartLaunchRq.
@Override
protected StartLaunchRQ buildStartLaunchRq(Date startTime, ListenerParameters parameters) {
StartLaunchRQ rq = super.buildStartLaunchRq(startTime, parameters);
getCustomLaunchAttributes().forEach((key, value) -> rq.getAttributes().add(new ItemAttributesRQ(key, value)));
return rq;
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project agent-java-junit5 by reportportal.
the class TestUtils method launchRQ.
public static StartLaunchRQ launchRQ(ListenerParameters parameters) {
StartLaunchRQ result = new StartLaunchRQ();
result.setName(parameters.getLaunchName());
result.setStartTime(Calendar.getInstance().getTime());
return result;
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project agent-java-junit5 by reportportal.
the class ReportPortalExtension method getLaunch.
/**
* Returns a current launch instance, starts new if no such instance
*
* @param context JUnit's launch context
* @return represents current launch
*/
protected Launch getLaunch(ExtensionContext context) {
return launchMap.computeIfAbsent(getLaunchId(context), id -> {
ReportPortal rp = getReporter();
ListenerParameters params = rp.getParameters();
StartLaunchRQ rq = buildStartLaunchRq(params);
Launch launch = rp.newLaunch(rq);
Runtime.getRuntime().addShutdownHook(getShutdownHook(id));
Maybe<String> launchIdResponse = launch.start();
if (params.isCallbackReportingEnabled()) {
TEST_ITEM_TREE.setLaunchId(launchIdResponse);
}
return launch;
});
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project agent-java-junit5 by reportportal.
the class LaunchStartTimeTest method verify_start_time_has_correct_order.
@Test
public void verify_start_time_has_correct_order() {
TestUtils.runClasses(TestIncorrectStartTime.class);
ArgumentCaptor<StartLaunchRQ> startLaunchCaptor = ArgumentCaptor.forClass(StartLaunchRQ.class);
verify(client, timeout(TimeUnit.SECONDS.toMillis(2)).times(1)).startLaunch(startLaunchCaptor.capture());
ArgumentCaptor<StartTestItemRQ> startSuiteCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
verify(client, timeout(TimeUnit.SECONDS.toMillis(2)).times(1)).startTestItem(startSuiteCaptor.capture());
ArgumentCaptor<StartTestItemRQ> startTestCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
verify(client, timeout(TimeUnit.SECONDS.toMillis(2)).times(1)).startTestItem(any(), startTestCaptor.capture());
Date launchStart = startLaunchCaptor.getValue().getStartTime();
Date suiteStart = startSuiteCaptor.getValue().getStartTime();
Date itemStart = startTestCaptor.getValue().getStartTime();
assertThat(launchStart, lessThanOrEqualTo(suiteStart));
assertThat(suiteStart, lessThanOrEqualTo(itemStart));
}
Aggregations