Search in sources :

Example 31 with StartLaunchRQ

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;
}
Also used : StartLaunchRQ(com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ)

Example 32 with StartLaunchRQ

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;
}
Also used : StartLaunchRQ(com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ)

Example 33 with StartLaunchRQ

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;
}
Also used : StartLaunchRQ(com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ)

Example 34 with StartLaunchRQ

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;
    });
}
Also used : StartLaunchRQ(com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ) ListenerParameters(com.epam.reportportal.listeners.ListenerParameters) ReportPortal(com.epam.reportportal.service.ReportPortal) Launch(com.epam.reportportal.service.Launch)

Example 35 with StartLaunchRQ

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));
}
Also used : StartLaunchRQ(com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Date(java.util.Date) Test(org.junit.jupiter.api.Test)

Aggregations

StartLaunchRQ (com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ)35 Test (org.junit.jupiter.api.Test)20 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)10 ItemAttributesRQ (com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ)9 ListenerParameters (com.epam.reportportal.listeners.ListenerParameters)7 Launch (com.epam.ta.reportportal.entity.launch.Launch)7 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)6 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)5 LaunchRepository (com.epam.ta.reportportal.dao.LaunchRepository)4 ErrorRS (com.epam.ta.reportportal.ws.model.ErrorRS)4 MvcResult (org.springframework.test.web.servlet.MvcResult)4 LaunchBuilder (com.epam.ta.reportportal.ws.converter.builders.LaunchBuilder)3 Date (java.util.Date)3 ApplicationEventPublisher (org.springframework.context.ApplicationEventPublisher)3 ReportPortal (com.epam.reportportal.service.ReportPortal)2 MessageBus (com.epam.ta.reportportal.core.events.MessageBus)2 IdentityUtil (com.epam.ta.reportportal.core.item.identity.IdentityUtil)2 TestItemRepository (com.epam.ta.reportportal.dao.TestItemRepository)2 TestItem (com.epam.ta.reportportal.entity.item.TestItem)2 ErrorType (com.epam.ta.reportportal.ws.model.ErrorType)2