fix test: propertyIntegrationAxis2ClientRemovePropertiesTestCase
package org.wso2.carbon.esb.mediator.test.property;
import org.apache.axiom.om.OMElement;
-import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.wso2.carbon.integration.common.admin.client.LogViewerClient;
-import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent;
+import org.wso2.esb.integration.common.utils.CarbonLogReader;
import org.wso2.esb.integration.common.utils.ESBIntegrationTest;
import static org.testng.Assert.assertTrue;
@@ -34,17 +32,17 @@ import static org.testng.Assert.assertTrue;
public class propertyIntegrationAxis2ClientRemovePropertiesTestCase extends ESBIntegrationTest {
- private static LogViewerClient logViewer;
+ private CarbonLogReader carbonLogReader;
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
super.init();
- logViewer = new LogViewerClient(context.getContextUrls().getBackEndUrl(), sessionCookie);
+ carbonLogReader = new CarbonLogReader();
}
@Test(groups = "wso2.esb", description = "Remove action as \"value\" and type String (axis2-client scope)")
public void testStringVal() throws Exception {
- logViewer.clearLogs();
+ carbonLogReader.start();
OMElement response = axis2Client
.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("propertyAxis2ClientRemoveTestProxy"), null,
"Random Symbol");
@@ -53,26 +51,14 @@ public class propertyIntegrationAxis2ClientRemovePropertiesTestCase extends ESBI
"Integer Property Not Either Set or Removed in the Axis2 Client scope!!");
}
- private boolean isMatchFound(String matchStr) throws Exception {
+ private boolean isMatchFound(String matchStr) {
boolean isSet = false;
- LogEvent[] logs = logViewer.getAllSystemLogs();
- int size = logs.length;
- for (int i = size - 1; i >= 0; i--) {
- if (logs[i].getMessage().contains(matchStr)) {
- for (int j = i; j >= 0; j--) {
- if (logs[j].getMessage().contains("symbol = null")) {
+ String logs = carbonLogReader.getLogs();
+ carbonLogReader.stop();
+
+ if (logs.contains(matchStr) && logs.contains("symbol = null")) {
isSet = true;
- break;
- }
- }
- break;
- }
}
return isSet;
}
-
- @AfterClass(alwaysRun = true)
- public void destroy() throws Exception {
- cleanup();
- }
}
