• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SaveLogRQ类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.epam.ta.reportportal.ws.model.log.SaveLogRQ的典型用法代码示例。如果您正苦于以下问题:Java SaveLogRQ类的具体用法?Java SaveLogRQ怎么用?Java SaveLogRQ使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SaveLogRQ类属于com.epam.ta.reportportal.ws.model.log包,在下文中一共展示了SaveLogRQ类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: sendLog

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
public static void sendLog(final String message, final String level, final File file) {
	ReportPortal.emitLog(new Function<String, SaveLogRQ>() {
		@Override
		public SaveLogRQ apply(String item) {
			SaveLogRQ rq = new SaveLogRQ();
			rq.setMessage(message);
			rq.setTestItemId(item);
			rq.setLevel(level);
			rq.setLogTime(Calendar.getInstance().getTime());
			if (file != null) {
				rq.setFile(file);
			}
			return rq;
		}
	});
}
 
开发者ID:reportportal,项目名称:agent-java-cucumber,代码行数:17,代码来源:Utils.java


示例2: sendReportPortalMsg

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
@Override
public void sendReportPortalMsg(final ITestResult result) {
	ReportPortal.emitLog(new Function<String, SaveLogRQ>() {
		@Override
		public SaveLogRQ apply(String itemId) {
			SaveLogRQ rq = new SaveLogRQ();
			rq.setTestItemId(itemId);
			rq.setLevel("ERROR");
			rq.setLogTime(Calendar.getInstance().getTime());
			if (result.getThrowable() != null) {
				rq.setMessage(getStackTraceAsString(result.getThrowable()));
			} else {
				rq.setMessage("Test has failed without exception");
			}
			rq.setLogTime(Calendar.getInstance().getTime());

			return rq;
		}
	});

}
 
开发者ID:reportportal,项目名称:agent-java-testNG,代码行数:22,代码来源:TestNGService.java


示例3: reportTestItemFailure

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
@VisibleForTesting
void reportTestItemFailure(ReportableItemFootprint testItemFootprint, ErrorInfo errorInfo) {
	SaveLogRQ saveLogRQ = new SaveLogRQ();
	saveLogRQ.setLogTime(Calendar.getInstance().getTime());
	saveLogRQ.setTestItemId(testItemFootprint.getId());
	saveLogRQ.setMessage("Exception: " + ExceptionUtil.printStackTrace(errorInfo.getException()));
	saveLogRQ.setLevel("ERROR");
	try {
		reportPortalService.log(saveLogRQ);
	} catch (RestEndpointIOException ex) {
		handleRpException(ex, "Unable to send message to Report Portal");
	}
}
 
开发者ID:reportportal,项目名称:agent-java-spock,代码行数:14,代码来源:SpockReporter.java


示例4: reportTestItemFailure

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
@Test
public void reportTestItemFailure() throws RestEndpointIOException {
	String itemId = "Test item ID";
	ArgumentCaptor<SaveLogRQ> requestCaptor = forClass(SaveLogRQ.class);
	when(rpServiceMock.log(requestCaptor.capture())).thenReturn(null);
	ReportableItemFootprint footprintMock = createGenericFootprintMock(itemId, null);

	spockReporter.reportTestItemFailure(footprintMock, createErrorInfoMock(new Exception()));

	verify(rpServiceMock, times(1)).log(any(SaveLogRQ.class));
	verifyErrorLogRQ(requestCaptor.getValue(), itemId);
}
 
开发者ID:reportportal,项目名称:agent-java-spock,代码行数:13,代码来源:SpockReporterTest.java


示例5: reportTestItemFailure_rpPostThrowsException

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
@Test
public void reportTestItemFailure_rpPostThrowsException() throws RestEndpointIOException {
	SpockReporter spockReporterSpy = spy(spockReporter);
	RestEndpointIOException rpException = new RestEndpointIOException("");
	when(rpServiceMock.log(any(SaveLogRQ.class))).thenThrow(rpException);
	ReportableItemFootprint footprintMock = createGenericFootprintMock("Test item ID", null);

	spockReporterSpy.reportTestItemFailure(footprintMock, createErrorInfoMock(new Exception()));

	verify(spockReporterSpy, times(1)).handleRpException(eq(rpException), anyString());
}
 
开发者ID:reportportal,项目名称:agent-java-spock,代码行数:12,代码来源:SpockReporterTest.java


示例6: append

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
@Override
protected void append(final ILoggingEvent event) {
    emitLog(new Function<String, com.epam.ta.reportportal.ws.model.log.SaveLogRQ>() {
        @Override
        public com.epam.ta.reportportal.ws.model.log.SaveLogRQ apply(String itemId) {
            final String message = event.getFormattedMessage();
            final String level = event.getLevel().toString();
            final Date time = new Date(event.getTimeStamp());

            SaveLogRQ rq = new SaveLogRQ();
            rq.setLevel(level);
            rq.setLogTime(time);
            rq.setTestItemId(itemId);

            try {
                if (MESSAGE_PARSER.supports(message)) {
                    ReportPortalMessage rpMessage = MESSAGE_PARSER.parse(message);
                    TypeAwareByteSource data = rpMessage.getData();
                    com.epam.ta.reportportal.ws.model.log.SaveLogRQ.File file = new com.epam.ta.reportportal.ws.model.log.SaveLogRQ.File();
                    file.setContent(data.read());
                    file.setContentType(data.getMediaType());
                    file.setName(UUID.randomUUID().toString());

                    rq.setFile(file);
                    rq.setMessage(rpMessage.getMessage());
                } else {
                    rq.setMessage(encoder.getLayout().doLayout(event));
                }

            } catch (Exception e) {
                //skip
            }

            return rq;
        }
    });
}
 
开发者ID:reportportal,项目名称:logger-java-logback,代码行数:38,代码来源:ReportPortalAppender.java


示例7: finishTestStep

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
public void finishTestStep(TestStepResult testStepContext, TestCaseRunContext paramTestCaseRunContext) {

		LoggingContext loggingContext = CONTEXT_MAP.get(testStepContext.getTestStep().getTestCase().getId());
		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(@Nullable 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);
		}

		String log = asMarkdown(String.format("# ===========STEP '%s' %s===========", testStepContext.getTestStep().getName(),
				TestStatus.fromSoapUIStep(testStepContext.getStatus())));
		loggingContext.emit(asFunction(log, LEVEL_INFO, Calendar.getInstance().getTime()));

	}
 
开发者ID:reportportal,项目名称:agent-java-soapui,代码行数:33,代码来源:TestBasedSoapUIServiceImpl.java


示例8: asFunction

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
private Function<String, SaveLogRQ> asFunction(final String message, final String level, final Date time) {
	return new Function<String, SaveLogRQ>() {
		@Override
		public SaveLogRQ apply(@Nullable String id) {
			SaveLogRQ rq = new SaveLogRQ();
			rq.setLevel(level);
			rq.setLogTime(time);
			rq.setTestItemId(id);
			rq.setMessage(message);

			return rq;
		}
	};

}
 
开发者ID:reportportal,项目名称:agent-java-soapui,代码行数:16,代码来源:TestBasedSoapUIServiceImpl.java


示例9: getStepLogReport

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
protected List<SaveLogRQ> getStepLogReport(TestStepResult testStepContext) {
	List<SaveLogRQ> rqs = new ArrayList<SaveLogRQ>();
	for (ResultLogger<?> resultLogger : resultLoggers) {
		if (resultLogger.supports(testStepContext)) {
			rqs.addAll(resultLogger.buildLogs(testStepContext));
		}
	}
	return rqs;
}
 
开发者ID:reportportal,项目名称:agent-java-soapui,代码行数:10,代码来源:StepBasedSoapUIServiceImpl.java


示例10: prepareLogs

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
@Override
protected List<SaveLogRQ> prepareLogs(HttpMessageExchange result) {
    final HttpResponse testRS = (HttpResponse) result.getResponse();
    return Arrays.asList(
            prepareEntity( "REQUEST", testRS.getRequestHeaders().toString(), testRS.getRequestContent()),
            prepareEntity("RESPONSE", testRS.getResponseHeaders().toString(), testRS.getContentAsString()));
}
 
开发者ID:reportportal,项目名称:agent-java-soapui,代码行数:8,代码来源:HttpMessageExchangeLogger.java


示例11: prepareEntity

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
private SaveLogRQ prepareEntity(String prefix, String headers, String body) {
    StringBuilder rqLog = new StringBuilder();
    rqLog
            .append(prefix).append("\n")
            .append("HEADERS:\n")
            .append(headers);

    if (!isNullOrEmpty(body)) {
        rqLog.append("BODY:\n")
                .append(body);
    }
    return prepareEntity("INFO", rqLog.toString());

}
 
开发者ID:reportportal,项目名称:agent-java-soapui,代码行数:15,代码来源:HttpMessageExchangeLogger.java


示例12: prepareEntity

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
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;
}
 
开发者ID:reportportal,项目名称:agent-java-soapui,代码行数:8,代码来源:ResultLogger.java


示例13: BatchedReportPortalService

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
public BatchedReportPortalService(final RestEndpoint endpoint, final String apiBase, final String project, final int logsBatchSize) {

		super(endpoint, apiBase, project);

		saveLogQueue = new ThreadLocal<BatchExecutor<SaveLogRQ, BatchElementCreatedRS>>() {
			@Override
			protected BatchExecutor<SaveLogRQ, BatchElementCreatedRS> initialValue() {
				return new BatchExecutor<SaveLogRQ, BatchElementCreatedRS>() {

					@Override
					protected void executeBatch(Queue<BatchExecutor.Parameter<SaveLogRQ, BatchElementCreatedRS>> batch) throws IOException {

						MultiPartRequest.Builder<List<SaveLogRQ>> requestBuilder = new MultiPartRequest.Builder<List<SaveLogRQ>>();
						List<SaveLogRQ> serializedPart = new ArrayList<SaveLogRQ>(batch.size());

						for (BatchExecutor.Parameter<SaveLogRQ, BatchElementCreatedRS> batchItem : batch) {
							SaveLogRQ rq = batchItem.getParameter();
							serializedPart.add(batchItem.getParameter());

							if (null != rq.getFile()) {
								requestBuilder.addBinaryPart(Constants.LOG_REQUEST_BINARY_PART, rq.getFile().getName(),
										ContentType.APPLICATION_OCTET_STREAM.getMimeType(), rq.getFile().getContent());
							}
						}

						requestBuilder.addSerializedPart(Constants.LOG_REQUEST_JSON_PART, serializedPart);

						BatchSaveOperatingRS batchResponse = endpoint.post(apiBase + "/" + project + "/log", requestBuilder.build(),
								BatchSaveOperatingRS.class);
						for (BatchElementCreatedRS rsItem : batchResponse.getResponses()) {
							batch.poll().getResult().set(rsItem);
						}

					}

					@Override
					protected boolean execute(Queue<BatchExecutor.Parameter<SaveLogRQ, BatchElementCreatedRS>> batch) throws IOException {
						return batch.size() >= logsBatchSize;
					}

				};
			}
		};

	}
 
开发者ID:reportportal,项目名称:client-java-core,代码行数:46,代码来源:BatchedReportPortalService.java


示例14: verifyErrorLogRQ

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
private static void verifyErrorLogRQ(SaveLogRQ errorLogRQ, String originItemId) {
	assertThat(errorLogRQ.getTestItemId(), equalTo(originItemId));
	assertThat(errorLogRQ.getLevel(), equalTo("ERROR"));
	assertThat(errorLogRQ.getMessage(), not(isEmptyString()));
}
 
开发者ID:reportportal,项目名称:agent-java-spock,代码行数:6,代码来源:SpockReporterTest.java


示例15: buildLogs

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
public final List<SaveLogRQ> buildLogs(TestStepResult result) {
	//noinspection unchecked
	return prepareLogs((T) result);
}
 
开发者ID:reportportal,项目名称:agent-java-soapui,代码行数:5,代码来源:ResultLogger.java


示例16: prepareLogs

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
@Override
protected List<SaveLogRQ> prepareLogs(TestStepResult result) {
	WsdlGroovyScriptTestStep step = ((WsdlGroovyScriptTestStep) result.getTestStep());
	return Arrays.asList(prepareEntity("INFO", "Executing script:"),
			prepareEntity("INFO", MarkdownUtils.asCode("groovy", step.getScript())));
}
 
开发者ID:reportportal,项目名称:agent-java-soapui,代码行数:7,代码来源:GroovyScriptLogger.java


示例17: log

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
/**
 * Log some data in report portal
 * 
 * @param rq
 * @throws RestEndpointIOException
 */
Result<? extends EntryCreatedRS> log(SaveLogRQ rq) throws RestEndpointIOException;
 
开发者ID:reportportal,项目名称:client-java-core,代码行数:8,代码来源:IReportPortalService.java


示例18: prepareLogs

import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; //导入依赖的package包/类
abstract protected List<SaveLogRQ> prepareLogs(T result); 
开发者ID:reportportal,项目名称:agent-java-soapui,代码行数:2,代码来源:ResultLogger.java



注:本文中的com.epam.ta.reportportal.ws.model.log.SaveLogRQ类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Tc类代码示例发布时间:2022-05-22
下一篇:
Java BatchToPartition类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap