本文整理汇总了Java中org.wso2.carbon.logging.view.stub.types.carbon.LogEvent.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java LogEvent.getMessage方法的具体用法?Java LogEvent.getMessage怎么用?Java LogEvent.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.logging.view.stub.types.carbon.LogEvent
的用法示例。
在下文中一共展示了LogEvent.getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSettingDefaultContentType
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
@Test(groups = "wso2.esb",
description = "Test to verify whether bocking enabled calls not going to set default content type")
public void testSettingDefaultContentType() throws Exception {
boolean isContentTypeAvailable = false;
logViewerClient.clearLogs();
HttpResponse response = HttpRequestUtil
.sendGetRequest(getProxyServiceURLHttp("CallMediatorNoDefaultContentTypeTestProxy"),
null);
LogEvent[] logs = logViewerClient.getAllRemoteSystemLogs();
for (LogEvent logEvent : logs) {
if (logEvent.getPriority().equals("INFO")) {
String message = logEvent.getMessage();
if (message.contains("Default_ContentType_Test_ContentType = null")) {
isContentTypeAvailable = true;
break;
}
}
}
Assert.assertTrue(isContentTypeAvailable, "Call mediator set default content type for get a request");
}
示例2: testURITemplateExpandWithPercentEncoding
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Sending http request with a query param consist of" +
" reserved character : ")
public void testURITemplateExpandWithPercentEncoding() throws Exception {
boolean isPercentEncoded = false;
logViewerClient.clearLogs();
HttpResponse response = HttpRequestUtil.sendGetRequest(
getApiInvocationURL("services/client/urlEncoded?queryParam=ESB:WSO2"),
null);
LogEvent[] logs = logViewerClient.getAllSystemLogs();
for (LogEvent logEvent : logs) {
String message = logEvent.getMessage();
if (message.contains("ESB%3AWSO2")) {
isPercentEncoded = true;
break;
}
}
Assert.assertTrue(isPercentEncoded,
"Reserved character should be percent encoded while uri-template expansion");
}
示例3: testURITemplateExpandWithPercentEncodingPathParamCase
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Sending http request with a path param consist of" +
" reserved character : ")
public void testURITemplateExpandWithPercentEncodingPathParamCase() throws Exception {
boolean isPercentEncoded = false;
logViewerClient.clearLogs();
HttpResponse response = HttpRequestUtil.sendGetRequest(
getApiInvocationURL("services/client/urlEncoded/ESB:WSO2"),
null);
LogEvent[] logs = logViewerClient.getAllSystemLogs();
for (LogEvent logEvent : logs) {
String message = logEvent.getMessage();
if (message.contains("To: /services/test_2/ESB%3AWSO2")) {
isPercentEncoded = true;
break;
}
}
Assert.assertTrue(isPercentEncoded,
"Reserved character should be percent encoded while uri-template expansion");
}
示例4: testURITemplateExpandWithEscapedPercentEncodingPathParam
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Sending http request with a path param consist of reserved " +
"character : with percent encoding escaped at uri-template expansion")
public void testURITemplateExpandWithEscapedPercentEncodingPathParam() throws Exception {
boolean isPercentEncoded = false;
logViewerClient.clearLogs();
HttpResponse response = HttpRequestUtil.sendGetRequest(
getApiInvocationURL("services/client/escapeUrlEncoded/ESB:WSO2"),
null);
LogEvent[] logs = logViewerClient.getAllSystemLogs();
for (LogEvent logEvent : logs) {
String message = logEvent.getMessage();
if (message.contains("To: /services/test_2/ESB%3AWSO2")) {
isPercentEncoded = true;
break;
}
}
Assert.assertFalse(isPercentEncoded,
"Reserved character should not be percent encoded while uri-template expansion as escape enabled");
}
示例5: TestCreateFileInRoot
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
@Test(groups = "wso2.esb", description = "VFS NPE in Creating a File in FTP directly in root directory")
public void TestCreateFileInRoot() throws Exception {
// To check the timed out exception happened
boolean timeout = false;
// To check whether the NPE happened
boolean isError = false;
try {
OMElement response = axis2Client.sendSimpleStockQuoteRequest(
getProxyServiceURLHttp("VFSProxyFileCreateInRoot"), null,
"WSO2");
} catch (AxisFault axisFault) {
if (axisFault.getLocalizedMessage().contains("Read timed out")) {
timeout = true;
}
} finally {
removeProxy("VFSProxyFileCreateInRoot");
}
LogEvent[] logs = logViewerClient.getAllSystemLogs();
for (LogEvent logEvent : logs) {
String message = logEvent.getMessage();
if (message.contains("Error creating file under the FTP root")) {
isError = true;
break;
}
}
Assert.assertFalse(
isError && timeout,
" The null check for the replyFile.getParent() in VFSTransportSender is not available");
}
示例6: isPropertyContainedInLog
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
/**
* This method check whether given property contains in the logs.
* @param property required property which needs to be validate if exists or not.
* @return A Boolean
*/
private boolean isPropertyContainedInLog(String property) throws LogViewerLogViewerException, RemoteException {
LogEvent[] logs = logViewerClient.getAllRemoteSystemLogs();
boolean containsProperty = false;
for (LogEvent logEvent : logs) {
String message = logEvent.getMessage();
if (message.contains(property)) {
containsProperty = true;
break;
}
}
return containsProperty;
}
示例7: stringExistsInLog
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
protected boolean stringExistsInLog(String string) throws Exception {
LogEvent[] logs = logViewerClient.getAllRemoteSystemLogs();
boolean logFound = false;
for (LogEvent item : logs) {
if (item.getPriority().equals("INFO")) {
String message = item.getMessage();
if (message.contains(string)) {
logFound = true;
break;
}
}
}
return logFound;
}
示例8: testForEachInlineSequenceWithIterateEndpoint
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
@Test(groups = "wso2.esb", description = "Test foreach inline sequence to transform payload, passed to endpoint using iterate and aggregate mediators")
public void testForEachInlineSequenceWithIterateEndpoint() throws Exception {
loadESBConfigurationFromClasspath(
"/artifacts/ESB/mediatorconfig/foreach/foreach_simple.xml");
logViewer.clearLogs();
String response = client.getMultipleCustomResponse(getProxyServiceURLHttp("foreachSequentialExecutionTestProxy"), "IBM", 2);
Assert.assertNotNull(response);
LogEvent[] logs = logViewer.getAllRemoteSystemLogs();
int forEachCount = 0;
for (LogEvent log : logs) {
String message = log.getMessage();
if (message.contains("foreach = in")) {
if (!message.contains("IBM")) {
Assert.fail("Incorrect message entered ForEach scope");
}
forEachCount++;
}
}
Assert.assertEquals(forEachCount, 2, "Count of messages entered ForEach scope is incorrect");
OMElement envelope = client.toOMElement(response);
OMElement soapBody = envelope.getFirstElement();
Iterator iterator =
soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
int i = 0;
while (iterator.hasNext()) {
i++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("IBM"));
}
Assert.assertEquals(i, 2, "Message count mismatched in response");
}
示例9: testSmallNumbers
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
@Test(groups = "wso2.esb", description = "Tests small message in small number ~20")
public void testSmallNumbers() throws Exception {
logViewer.clearLogs();
OMElement response = null;
for (int i = 0; i < 20; i++) {
response = axis2Client.sendCustomQuoteRequest(getProxyServiceURLHttp("foreachSmallMessageTestProxy"),
null, "IBM" + symbol);
Assert.assertNotNull(response);
Assert.assertTrue(response.toString().contains("IBM"), "Incorrect symbol in response");
response = null;
}
LogEvent[] logs = logViewer.getAllRemoteSystemLogs();
int afterLogSize = logs.length;
int forEachCount = 0;
for (LogEvent log : logs) {
String message = log.getMessage();
if (message.contains("foreach = in")) {
if (!message.contains("IBM")) {
Assert.fail("Incorrect message entered ForEach scope. Could not find symbol IBM ..");
}
forEachCount++;
}
}
Assert.assertEquals(forEachCount, 20,
"Count of messages entered ForEach scope is incorrect");
}
示例10: testRabbitMQConsumer
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Test ESB as a RabbitMQ Consumer ")
public void testRabbitMQConsumer() throws Exception {
logViewer.clearLogs();
String message = "<ser:placeOrder xmlns:ser=\"http://services.samples\">\n" + "<ser:order>\n"
+ "<ser:price>100</ser:price>\n" + "<ser:quantity>2000</ser:quantity>\n"
+ "<ser:symbol>RMQ</ser:symbol>\n" + "</ser:order>\n" + "</ser:placeOrder>";
for (int i = 0; i < 200; i++) {
sender.sendMessage(message, "text/plain");
}
RabbitMQTestUtils.waitForLogToGetUpdated();
LogEvent[] logs = logViewer.getAllRemoteSystemLogs();
int count = 0;
for (LogEvent logEvent : logs) {
if (logEvent == null) {
continue;
}
String logMessage = logEvent.getMessage();
if (logMessage.contains("received = true")) {
count++;
}
}
Assert.assertEquals(count, 200, "All messages are not received from queue");
}
示例11: isPropertyContainedInLog
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
/**
* This method check whether given property contains in the logs.
*
* @param property required property which needs to be validate if exists or not.
* @return A Boolean
*/
private boolean isPropertyContainedInLog(String property) throws LogViewerLogViewerException, RemoteException {
LogEvent[] logs = logViewerClient.getAllRemoteSystemLogs();
boolean containsProperty = false;
for (LogEvent logEvent : logs) {
String message = logEvent.getMessage();
if (message.contains(property)) {
containsProperty = true;
break;
}
}
return containsProperty;
}
示例12: stringExistsInLog
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
protected boolean stringExistsInLog(String value) throws Exception {
LogEvent[] logs = logViewerClient.getAllRemoteSystemLogs();
boolean logFound = false;
for (LogEvent logEvent : logs) {
String msg = logEvent.getMessage();
if (msg.contains(value)) {
logFound = true;
break;
}
}
return logFound;
}
示例13: testMPRetryUponHTTP_SC_500_response_with_200_And_202_AsNonRetrySCs
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Test whether a Message Processor retries sending the message to the EP when the response status code is 500 and MP is configured with 200,202 as non-retry status codes.")
public void testMPRetryUponHTTP_SC_500_response_with_200_And_202_AsNonRetrySCs()
throws RemoteException,
InterruptedException {
boolean isRetriedUpon_500_response = false;
boolean isRetryCompleted = false;
boolean isMpDeactivated = false;
int retryAttempts = 0;
final String proxyUrl = getProxyServiceURLHttp(PROXY_SERVICE_NAME);
AxisServiceClient client = new AxisServiceClient();
client.sendRobust(createPlaceOrderRequest(3.141593E0, 4, "IBM"), proxyUrl, "placeOrder");
logViewerClient =
new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
// Wait till the log appears
Thread.sleep(20000);
LogEvent[] logs = logViewerClient.getAllSystemLogs();
for (LogEvent logEvent : logs) {
String message = logEvent.getMessage();
if (message.contains(EXPECTED_ERROR_MESSAGE)) {
isRetriedUpon_500_response = true;
retryAttempts++;
} else if (message.contains(EXPECTED_MP_DEACTIVATION_MSG)) {
isMpDeactivated = true;
}
}
if (retryAttempts == RETRY_COUNT) {
isRetryCompleted = true;
}
Assert.assertTrue(isRetriedUpon_500_response && isRetryCompleted && isMpDeactivated,
"MP does not retry sending the request upon receiving HTTP SC 500 response");
}
开发者ID:wso2,项目名称:product-ei,代码行数:36,代码来源:ESBJAVA4279_MPRetryUponResponseSC_500_withNonRetryStatusCodes_200_and_202_TestCase.java
示例14: isLogAvailable
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
private boolean isLogAvailable(String validateLog) {
for (LogEvent logEvent : logs) {
String message = logEvent.getMessage();
if (message.contains(validateLog)) {
return true;
}
}
return false;
}
示例15: transactionRolBackWhenErrorTest
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入方法依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "Test transaction rollback : ESBJAVA-4863 and ESBJAVA-4293")
public void transactionRolBackWhenErrorTest() throws Exception {
logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
logViewerClient.clearLogs();
JMSTopicMessagePublisher mbTopicMessageProducer = new JMSTopicMessagePublisher(
MessageBrokerConfigurationProvider.getBrokerConfig());
mbTopicMessageProducer.connect("MyNewTopic");
mbTopicMessageProducer.publish("<message>Hi</message>");
mbTopicMessageProducer.disconnect();
int rollbackCount = 0;
long startTime = System.currentTimeMillis();
while (rollbackCount < 10 && (System.currentTimeMillis() - startTime) < 30000) {
LogEvent[] logs = logViewerClient.getAllRemoteSystemLogs();
if(logs == null){
continue;
}
rollbackCount = 0;
for (LogEvent event : logs) {
if(log != null) {
String message = event.getMessage();
if (message.contains("### I am Event subscriber (inbound endpoint) ###")) {
rollbackCount++;
}
}
}
Thread.sleep(1000);
}
//if the message failed to mediate ESB rollback the message. Then message broker try 10 times
//to send the message again. So total count is 11 including the first try
Assert.assertEquals(rollbackCount, 11, "ESB does not process message again after rollback");
}