Search in sources :

Example 1 with SaveLogRQ

use of com.epam.ta.reportportal.ws.model.log.SaveLogRQ in project agent-java-soapui by reportportal.

the class ResultLogger method prepareEntity.

protected final SaveLogRQ prepareEntity(String level, String message) {
    SaveLogRQ logRQ = new SaveLogRQ();
    logRQ.setLevel(level);
    logRQ.setLogTime(Calendar.getInstance().getTime());
    logRQ.setMessage(message);
    return logRQ;
}
Also used : SaveLogRQ(com.epam.ta.reportportal.ws.model.log.SaveLogRQ)

Example 2 with SaveLogRQ

use of com.epam.ta.reportportal.ws.model.log.SaveLogRQ in project agent-java-soapui by reportportal.

the class TestBasedSoapUIServiceImpl method asFunctionFile.

public static Function<String, SaveLogRQ> asFunctionFile(final String message, final SaveLogRQ.File file, final String level, final Date time) {
    return new Function<String, SaveLogRQ>() {

        @Override
        public SaveLogRQ apply(String id) {
            SaveLogRQ rq = new SaveLogRQ();
            rq.setLevel(level);
            rq.setLogTime(time);
            rq.setTestItemId(id);
            rq.setMessage(message);
            rq.setFile(file);
            return rq;
        }
    };
}
Also used : Function(rp.com.google.common.base.Function) SaveLogRQ(com.epam.ta.reportportal.ws.model.log.SaveLogRQ)

Example 3 with SaveLogRQ

use of com.epam.ta.reportportal.ws.model.log.SaveLogRQ in project agent-java-soapui by reportportal.

the class TestBasedSoapUIServiceImpl method finishTestStep.

public void finishTestStep(TestStepResult testStepContext, TestCaseRunContext paramTestCaseRunContext) {
    LoggingContext loggingContext = CONTEXT_MAP.get(TEST_CASE_ID);
    if (!RpServiceBuilder.REPORTER_DISABLE) {
        String logStepData = getLogStepData(testStepContext);
        if (!Strings.isNullOrEmpty(logStepData)) {
            loggingContext.emit(asFunction(logStepData, LEVEL_INFO, Calendar.getInstance().getTime()));
        }
        for (final SaveLogRQ rq : getStepLogReport(testStepContext)) {
            loggingContext.emit(new Function<String, SaveLogRQ>() {

                @Override
                public SaveLogRQ apply(String id) {
                    rq.setTestItemId(id);
                    return rq;
                }
            });
        }
    }
    if (TestStepResult.TestStepStatus.FAILED.equals(testStepContext.getStatus())) {
        loggingContext.emit(asFunction(getStepError(testStepContext), "ERROR", Calendar.getInstance().getTime()));
    }
    if (TestStepResult.TestStepStatus.CANCELED.equals(testStepContext.getStatus())) {
        context.setTestCanceled(true);
    }
    if (!RpServiceBuilder.REPORTER_DISABLE) {
        String log = asMarkdown(String.format("# ===========STEP '%s' %s===========", testStepContext.getTestStep().getName(), TestStatus.fromSoapUIStep(testStepContext.getStatus())));
        loggingContext.emit(asFunction(log, LEVEL_INFO, Calendar.getInstance().getTime()));
    }
}
Also used : LoggingContext(com.epam.reportportal.service.LoggingContext) SaveLogRQ(com.epam.ta.reportportal.ws.model.log.SaveLogRQ)

Example 4 with SaveLogRQ

use of com.epam.ta.reportportal.ws.model.log.SaveLogRQ in project agent-java-soapui by reportportal.

the class StepBasedSoapUIServiceImpl method finishTestStep.

public void finishTestStep(TestStepResult testStepContext, TestCaseRunContext paramTestCaseRunContext) {
    if (null != launch) {
        Maybe<String> testId = (Maybe<String>) paramTestCaseRunContext.getProperty(ID);
        String logStepData = getLogStepData(testStepContext);
        if (!Strings.isNullOrEmpty(logStepData)) {
            ReportPortal.emitLog(logStepData, "INFO", Calendar.getInstance().getTime());
        }
        for (final SaveLogRQ rq : getStepLogReport(testStepContext)) {
            ReportPortal.emitLog(new Function<String, SaveLogRQ>() {

                @Override
                public SaveLogRQ apply(String id) {
                    rq.setTestItemId(id);
                    return rq;
                }
            });
        }
        if (TestStepStatus.FAILED.equals(testStepContext.getStatus())) {
            ReportPortal.emitLog(getStepError(testStepContext), "ERROR", Calendar.getInstance().getTime());
        }
        FinishTestItemRQ rq = new FinishTestItemRQ();
        rq.setEndTime(Calendar.getInstance().getTime());
        if (TestStepStatus.CANCELED.equals(testStepContext.getStatus())) {
            context.setTestCanceled(true);
        }
        rq.setStatus(TestStatus.fromSoapUIStep(testStepContext.getStatus()));
        this.launch.finishTestItem(testId, rq);
    }
}
Also used : Maybe(io.reactivex.Maybe) SaveLogRQ(com.epam.ta.reportportal.ws.model.log.SaveLogRQ) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ)

Example 5 with SaveLogRQ

use of com.epam.ta.reportportal.ws.model.log.SaveLogRQ in project agent-java-soapui by reportportal.

the class TestBasedSoapUIServiceImpl method asFunction.

public static Function<String, SaveLogRQ> asFunction(final String message, final String level, final Date time) {
    return new Function<String, SaveLogRQ>() {

        @Override
        public SaveLogRQ apply(String id) {
            SaveLogRQ rq = new SaveLogRQ();
            rq.setLevel(level);
            rq.setLogTime(time);
            rq.setTestItemId(id);
            rq.setMessage(message);
            return rq;
        }
    };
}
Also used : Function(rp.com.google.common.base.Function) SaveLogRQ(com.epam.ta.reportportal.ws.model.log.SaveLogRQ)

Aggregations

SaveLogRQ (com.epam.ta.reportportal.ws.model.log.SaveLogRQ)5 Function (rp.com.google.common.base.Function)2 LoggingContext (com.epam.reportportal.service.LoggingContext)1 FinishTestItemRQ (com.epam.ta.reportportal.ws.model.FinishTestItemRQ)1 Maybe (io.reactivex.Maybe)1