当前位置: 首页>>代码示例>>Java>>正文


Java LogEvent类代码示例

本文整理汇总了Java中org.wso2.carbon.logging.view.stub.types.carbon.LogEvent的典型用法代码示例。如果您正苦于以下问题:Java LogEvent类的具体用法?Java LogEvent怎么用?Java LogEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LogEvent类属于org.wso2.carbon.logging.view.stub.types.carbon包,在下文中一共展示了LogEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertIfLogExists

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
private static boolean assertIfLogExists(LogViewerClient logViewerClient, String expected)
        throws RemoteException, LogViewerLogViewerException {

    LogEvent[] systemLogs;
    systemLogs = logViewerClient.getAllRemoteSystemLogs();
    boolean matchFound = false;
    if (systemLogs != null) {
        for (LogEvent logEvent : systemLogs) {
            if (logEvent == null) {
                continue;
            }
            if (logEvent.getMessage().contains(expected)) {
                matchFound = true;
                break;
            }
        }
    }
    return matchFound;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:20,代码来源:Utils.java

示例2: assertIfLogExistsWithGivenPriority

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
/**
 * Check whether a log found with expected string of given priority
 *
 * @param logViewerClient LogViewerClient object
 * @param priority        priority level
 * @param expected        expected string
 * @return true if a log found with expected string of given priority, false otherwise
 * @throws RemoteException
 * @throws LogViewerLogViewerException
 */
private static boolean assertIfLogExistsWithGivenPriority(LogViewerClient logViewerClient, String priority, String expected)
        throws RemoteException, LogViewerLogViewerException {

    LogEvent[] systemLogs;
    systemLogs = logViewerClient.getAllRemoteSystemLogs();
    boolean matchFound = false;
    if (systemLogs != null) {
        for (LogEvent logEvent : systemLogs) {
            if (logEvent == null) {
                continue;
            }
            if (logEvent.getPriority().equals(priority) && logEvent.getMessage().contains(expected)) {
                matchFound = true;
                break;
            }
        }
    }
    return matchFound;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:30,代码来源:Utils.java

示例3: testHL7InboundAutoAck

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@Test(priority=2, groups = { "wso2.esb" }, description = "Test HL7 Inbound Automated ACK")
public void testHL7InboundAutoAck() throws Exception {
    int beforeLogCount = logViewerClient.getAllRemoteSystemLogs().length;
    addInboundEndpoint(addEndpoint1());
    HL7InboundTestSender sender = new HL7InboundTestSender();
    String response = sender.send("localhost", 20000);
    Thread.sleep(500);
    LogEvent[] logs = logViewerClient.getAllSystemLogs();
    boolean found = false;
    for (int i = 0; i < (logs.length - beforeLogCount); i++) {
        if (logs[i].getMessage().contains("<MSG.3>ADT_A01</MSG.3>")) {
            found = true;
            break;
        }
    }
    Assert.assertTrue(response.contains("ACK^A01"));
    Assert.assertTrue(found, "Found HL7 message in ESB log");
    Thread.sleep(5000);
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:20,代码来源:HL7InboundTransportTest.java

示例4: testTenantIDInTenantResponsePath

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@Test(groups = {"wso2.esb"})
public void testTenantIDInTenantResponsePath() throws Exception {
    // create a tenant
    TenantManagementServiceClient tenantMgtAdminServiceClient = new TenantManagementServiceClient(contextUrls.getBackEndUrl(), sessionCookie);
    tenantMgtAdminServiceClient.addTenant("t5.com", "jhonporter", "jhon", "demo");
    // log as tenant
    AuthenticatorClient authClient = new AuthenticatorClient(contextUrls.getBackEndUrl());
    String session = authClient.login("[email protected]", "jhonporter", "localhost");
    // load configuration in tenant space
    esbUtils.loadESBConfigurationFrom("artifacts/ESB/ServiceChainingConfig.xml", contextUrls.getBackEndUrl(), session);
    // Create service client
    ServiceClient sc = getServiceClient("http://localhost:8480/services/t/t5.com/ServiceChainingProxy", null,
                                        "wso2");
    sc.fireAndForget(createStandardSimpleRequest("wso2"));
    // Get logs by tenant name
    LogViewerClient logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), sessionCookie);
    LogEvent[] logs = logViewerClient.getLogs("ALL", "RECEIVE", "t5.com", "");
    Assert.assertNotNull(logs);
    LogEvent receiveSeqLog_1 = getLogEventByMessage(logs, "DEBUG SEQ 1 = FIRST RECEIVE SEQUENCE");
    Assert.assertNotNull(receiveSeqLog_1);
    LogEvent receiveSeqLog_2 = getLogEventByMessage(logs, "DEBUG SEQ 2 = SECOND RECEIVE SEQUENCE");
    Assert.assertNotNull(receiveSeqLog_2);
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:24,代码来源:ServiceChainingTest.java

示例5: testJMSMessageStoreAndProcessor

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "JMS Message store/processor support for RESTful services.")
public void testJMSMessageStoreAndProcessor() throws Exception {
    HttpResponse response = httpClient.doPost(url, headers, payload, "application/json");
    Thread.sleep(10000);
    assertEquals(response.getStatusLine().getStatusCode(), 202);
    LogEvent[] logs = logViewer.getAllSystemLogs();
    int i = 1;
    for (LogEvent log : logs) {
        if (log.getMessage().contains(logLine0)) {
            ++i;
        }
        if (log.getMessage().contains(logLine1)) {
            ++i;
        }
    }
    if (i == 3) {
        Assert.assertTrue(true);
    } else {
        Assert.assertTrue(false);
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:22,代码来源:JMSMessageStoreProcRESTTestCase.java

示例6: testJmsResponse

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Test Sending message to a jms endpoint and check for response")
public void testJmsResponse() throws Exception {
	try {
		axis2Client.sendSimpleStockQuoteRequest(getMainSequenceURL(),
				null, "IBM");
		
	} catch (AxisFault fault) {
		String errMsg=fault.getMessage();						
		Assert.assertEquals(errMsg,"Send timeout", "JMS Client did not receive Send timeout");			
		
		LogViewerClient cli = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
		LogEvent[] logs = cli.getAllSystemLogs();
		Assert.assertNotNull(logs, "No logs found");
		Assert.assertTrue(logs.length > 0, "No logs found");
		boolean errorMsgTrue = Utils.checkForLogsWithPriority(cli,"ERROR", logLine0, 10);
		Assert.assertTrue(errorMsgTrue, "Axis Fault Did not receive");
	}
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:19,代码来源:ESBJAVA2824MissingResponseTestCase.java

示例7: updateMessageStoreBeingUsedTest

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "Updating MessageStore once it is used by message processor"
        , dependsOnMethods = "addMessageStoreConfigurationTest")
public void updateMessageStoreBeingUsedTest() throws Exception {
    int beforeLogSize = logViewer.getAllSystemLogs().length;
    messageStoreAdminClient.updateMessageStore(synapseConfig.getFirstChildWithName(
            new QName(synapseConfiguration.getNamespace().getNamespaceURI(), "messageStore")));
    Thread.sleep(5000);
    esbUtils.isMessageStoreDeployed(contextUrls.getBackEndUrl(), getSessionCookie(), messageStoreName);
    LogEvent[] logs = logViewer.getAllSystemLogs();
    int afterLogSize = logs.length;

    for (int i = 0; i < (afterLogSize - beforeLogSize); i++) {
        Assert.assertFalse(logs[i].getMessage().contains("synapse.message.processor.quartz.JMSTestMessageProcessor-forward job threw an")
                , "Exception observed in backend when editing message store which is used by message processor > " + logs[i].getMessage());
    }

}
 
开发者ID:wso2,项目名称:product-ei,代码行数:18,代码来源:ESBJAVA1716UpdatingJMSMessageStoreBeingUsedTestCase.java

示例8: passthroughTransportHttpProxy

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@Test(groups = "wso2.esb", description = "Passthrough Transport Http.proxy test case")
public void passthroughTransportHttpProxy() throws Exception {
    int beforeLogSize = logViewer.getAllSystemLogs().length;

    try {
        axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("HttpProxyTest"), "", "IBM");
    } catch (AxisFault expected) {
        //read timeout expected
    }
    LogEvent[] logs = logViewer.getAllSystemLogs();
    int afterLogSize = logs.length;

    boolean proxyhostEntryFound = false;
    for (int i = 0; i < (afterLogSize - beforeLogSize); i++) {
        if (logs[i].getMessage().contains("111.wso2.com:7777")) {
            proxyhostEntryFound = true;
            break;
        }
    }
    assertTrue(proxyhostEntryFound);
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:22,代码来源:PassthroughTransportHttpProxyTestCase.java

示例9: testResponseBodyOfHEADRequest

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@Test(groups = "wso2.esb", description = " Checking response for HEAD request contains a body")
public void testResponseBodyOfHEADRequest() throws Exception {
    SimpleHttpClient httpClient = new SimpleHttpClient();
    httpClient.doGet(contextUrls.getServiceUrl() + "/ClientProxy", null);

    LogEvent[] logs = logViewer.getAllSystemLogs();
    boolean errorLogFound = false;
    for (LogEvent log : logs) {
        if (log.getMessage().contains("HTTP protocol violation")) {
            errorLogFound = true;
            break;
        }
    }
    assertFalse(errorLogFound, "HTTP protocol violation for Http HEAD request, " +
            "Response for HEAD request contains a body");
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:17,代码来源:HeadMethodResponseTestCase.java

示例10: testDBMediator

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.PLATFORM })
@Test(groups = {"wso2.esb"}, description = "testDBMediator ")
public void testDBMediator() throws Exception {

    LogViewerClient logViewerClient =
            new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

    logViewerClient.clearLogs();

    AxisServiceClient client = new AxisServiceClient();

    client.sendRobust(Utils.getStockQuoteRequest("IBM")
            , getMainSequenceURL(), "getQuote");

    LogEvent[] getLogsInfo = logViewerClient.getAllSystemLogs();
    boolean assertValue = false;
    for (LogEvent event : getLogsInfo) {
        if (event.getMessage().contains("Stock Prize")) {
            assertValue = true;
            break;
        }
    }
    Assert.assertTrue(assertValue,
            "db lookup failed");

}
 
开发者ID:wso2,项目名称:product-ei,代码行数:27,代码来源:Sample364TestCase.java

示例11: testSynapseObservers

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@SetEnvironment(executionEnvironments = {ExecutionEnvironment.STANDALONE})
@Test(groups = {"wso2.esb"}, description = "Test synapse observer ",enabled = false)
public void testSynapseObservers() throws Exception {

    Thread.sleep(30000);

    boolean isRequestLogFound = false;

    LogEvent[] logEvents = logViewerClient.getAllSystemLogs();
    for (LogEvent event : logEvents) {
        if (event.getMessage().contains("Simple logging observer initialized")) {
            isRequestLogFound = true;
            break;
        }
    }

    Assert.assertTrue("Simple observer not working", isRequestLogFound);

}
 
开发者ID:wso2,项目名称:product-ei,代码行数:20,代码来源:Sample651TestCase.java

示例12: testStartupLogs

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@Test(groups = "wso2.esb", enabled = true, description = "Test server start up with Eager loading")
public void testStartupLogs() throws Exception {
    LogEvent[] logs = this.logViewerClient.getAllSystemLogs();
    Assert.assertNotNull(logs, "No logs found");
    Assert.assertTrue(logs.length > 0, "No logs found");
    boolean serverStarted = false;
    boolean serverEagerLoaded = false;
    if(logs.length > 0) {
        for (int i = 0; i < logs.length; i++) {
            if (logs[i].getMessage().contains("Using tenant eager loading policy")) {
                serverEagerLoaded = true;
            } else if (logs[i].getMessage().contains("WSO2 Carbon started in ")) {
                serverStarted = true;
            }
        }
        Assert.assertTrue(serverEagerLoaded, "Server was not started with Tenant Eager Loading enabled.");
        Assert.assertTrue(serverStarted, "Server start-up failed with Tenant Eager Loading enabled.");
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:20,代码来源:EagerLoadingTestCase.java

示例13: searchInLogs

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
private boolean searchInLogs(LogViewerClient logViewerClient, String searchString)
        throws LogViewerLogViewerException, RemoteException, InterruptedException {
    boolean logFound = false;
    for (int i = 0; i < 60; i++) {
        LogEvent[] logEvents = logViewerClient.getAllRemoteSystemLogs();
        if (logEvents != null) {
            for (LogEvent logEvent : logEvents) {
                if (logEvent == null) {
                    continue;
                }
                if (logEvent.getMessage().contains(searchString)) {
                    logFound = true;
                    break;
                }
            }
        }
        if (logFound) {
            break;
        }
        Thread.sleep(500);
    }
    return logFound;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:24,代码来源:SynapseArtifactsHotDeploymentTestCase.java

示例14: testStoreMediatorEmptyOMArrayPropertySerialize

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "Test if Store Mediator Serialize Empty OM Array without Exception")
public void testStoreMediatorEmptyOMArrayPropertySerialize() throws Exception {
    logViewerClient.clearLogs();
    String url = getApiInvocationURL("SerializeProperty")+"/serializeOMArray";
    SimpleHttpClient httpClient = new SimpleHttpClient();
    httpClient.doGet(url, null);
    TimeUnit.SECONDS.sleep(10);
    LogEvent[] logs = logViewerClient.getAllRemoteSystemLogs();
    boolean logFound = false;
    if (logs != null) {
        for (LogEvent item : logs) {
            if (item.getMessage().contains("Index: 0, Size: 0") && item.getPriority().contains("ERROR")) {
                logFound = true;
                break;
            }
        }
    }
    assertFalse(logFound, "Exception thrown when serializing OM Array property by Store Mediator");
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:20,代码来源:ESBJAVA4470StoreMediatorEmptyOMArraySerializeException.java

示例15: deployProxyService

import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; //导入依赖的package包/类
@Test(groups = "wso2.esb", description = "Deploying proxy when the pinnedServer is having another instance name")
public void deployProxyService() throws Exception {
    OMElement proxyConfig = esbUtils.loadResource(File.separator + "artifacts" + File.separator + "ESB"
                                                  + File.separator + "proxyconfig" + File.separator + "proxy"
                                                  + File.separator + "proxyservice"
                                                  + File.separator + "proxyWithPinnedServer.xml");
    ProxyServiceAdminClient proxyAdmin = new ProxyServiceAdminClient(contextUrls.getBackEndUrl()
            , getSessionCookie());
    proxyAdmin.addProxyService(proxyConfig);

    LogViewerClient logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    LogEvent[] logEvents = logViewerClient.getAllRemoteSystemLogs();
    boolean isLogMessageFound = false;

    for (LogEvent log : logEvents) {
        if (log != null && log.getMessage().contains("not in pinned servers list. Not deploying " +
                                                     "Proxy service : pinnedServerProxy")) {
            isLogMessageFound = true;
            break;
        }
    }
    Assert.assertTrue(isLogMessageFound, "Log message not found in the console log");
    //proxy service should not be deployed since the pinnedServer does not contain this server name
    Assert.assertFalse(esbUtils.isProxyDeployed(contextUrls.getBackEndUrl(), getSessionCookie()
            , proxyServiceName), "Proxy service deployed successfully");
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:27,代码来源:ESBJAVA4540PinnedServerParameterTestCase.java


注:本文中的org.wso2.carbon.logging.view.stub.types.carbon.LogEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。