@Test(groups = "wso2.esb", description = "Tests small message in small number ~100")
  public void testLargeNumbers() throws Exception {
    int beforeLogSize = logViewer.getAllRemoteSystemLogs().length;

    OMElement response = null;
    for (int i = 0; i < 100; i++) {
      response = axis2Client.sendCustomQuoteRequest(getMainSequenceURL(), null, "MSFT" + symbol);
      Assert.assertNotNull(response);
      Assert.assertTrue(
          response.toString().contains("MSFT"),
          "Incorrect symbol in response. Could not find symbol MSFT ..");
      response = null;
    }

    LogEvent[] logs = logViewer.getAllRemoteSystemLogs();
    int afterLogSize = logs.length;
    int forEachCount = 0;

    for (int i = (afterLogSize - beforeLogSize - 1); i >= 0; i--) {
      String message = logs[i].getMessage();
      if (message.contains("foreach = in")) {
        if (!message.contains("MSFT")) {
          Assert.fail("Incorrect message entered ForEach scope");
        }
        forEachCount++;
      }
    }

    Assert.assertEquals(forEachCount, 100, "Count of messages entered ForEach scope is incorrect");
  }
Ejemplo n.º 2
0
 public boolean testSearchLogs() throws RemoteException {
   LogEvent[] logEvents =
       logViewerClient.getLogs(
           "WARN", "A resource with the given name and namespace exists", "", "");
   return (logEvents[0]
       .getMessage()
       .contains("A resource with the given name and namespace exists"));
 }
  protected boolean stringExistsInLog(String string) throws Exception {
    LogViewerClient logViewerClient =
        new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    LogEvent[] logs = logViewerClient.getAllSystemLogs();
    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;
  }