use of com.epam.reportportal.service.LoggingContext in project agent-java-soapui by reportportal.
the class CustomLoggerService method log.
public static void log(String message, String level) {
if (TEST_CASE_ID != null) {
LoggingContext loggingContext = CONTEXT_MAP.get(TEST_CASE_ID);
loggingContext.emit(asFunction(message, level, Calendar.getInstance().getTime()));
}
}
use of com.epam.reportportal.service.LoggingContext in project agent-java-soapui by reportportal.
the class TestBasedSoapUIServiceImpl method startTestStep.
public void startTestStep(TestStep testStep, TestCaseRunContext context) {
if (!RpServiceBuilder.REPORTER_DISABLE) {
String log = asMarkdown(String.format("# ===========STEP '%s' STARTED===========", testStep.getName()));
LoggingContext loggingContext = CONTEXT_MAP.get(TEST_CASE_ID);
loggingContext.emit(asFunction(log, LEVEL_INFO, Calendar.getInstance().getTime()));
}
}
use of com.epam.reportportal.service.LoggingContext 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()));
}
}
use of com.epam.reportportal.service.LoggingContext in project agent-java-soapui by reportportal.
the class CustomLoggerService method logFile.
public static void logFile(String message, File file, String level) throws IOException {
if (TEST_CASE_ID != null) {
byte[] fileContent = Files.readAllBytes(file.toPath());
SaveLogRQ.File rqFile = new SaveLogRQ.File();
rqFile.setContent(fileContent);
rqFile.setContentType(Files.probeContentType(file.toPath()));
rqFile.setName(UUID.randomUUID().toString());
LoggingContext loggingContext = CONTEXT_MAP.get(TEST_CASE_ID);
loggingContext.emit(asFunctionFile(message, rqFile, level, Calendar.getInstance().getTime()));
}
}
use of com.epam.reportportal.service.LoggingContext in project agent-java-soapui by reportportal.
the class TestBasedSoapUIServiceImpl method startTestCase.
@Override
public void startTestCase(TestCase testCase, PropertyExpansionContext propertyContext) {
Maybe<String> id = startItem(testCase.getName(), TestItemType.TEST_STEP, fromStringId(testCase.getTestSuite().getPropertyValue(ID)));
testCase.setPropertyValue(ID, toStringId(id));
LoggingContext loggingContext = LoggingContext.init(id, this.reportPortal.getClient());
CONTEXT_MAP.put(TEST_CASE_ID = testCase.getId(), loggingContext);
}
Aggregations