Fix RestPostFixUrlTest case failure
+/**
+ * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * <p>
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.wso2.carbon.esb.rest.test.api;
import org.testng.Assert;
-import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.automation.test.utils.http.client.HttpRequestUtil;
-import org.wso2.carbon.integration.common.admin.client.LogViewerClient;
+import org.wso2.esb.integration.common.utils.CarbonLogReader;
import org.wso2.esb.integration.common.utils.ESBIntegrationTest;
-import org.wso2.esb.integration.common.utils.Utils;
-import java.io.File;
/**
* Related to Patch Automation https://wso2.org/jira/browse/ESBJAVA-3260 This
@@ -18,15 +33,12 @@ import java.io.File;
public class RestPostFixUrlTest extends ESBIntegrationTest {
- private LogViewerClient logViewerClient;
+ private CarbonLogReader logReader;
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
super.init();
- loadESBConfigurationFromClasspath(
- File.separator + "artifacts" + File.separator + "ESB" + File.separator + "synapseconfig"
- + File.separator + "rest" + File.separator + "RestPostFixUrl.xml");
- logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
+ logReader = new CarbonLogReader();
}
@Test(groups = { "wso2.esb" }, description = "Sending a Message Via REST with additional resource")
@@ -36,12 +48,14 @@ public class RestPostFixUrlTest extends ESBIntegrationTest {
* sending request from Client API with additional resource
* "anotherParam" services/client/anotherParam
*/
+ logReader.start();
HttpRequestUtil.sendGetRequest(getApiInvocationURL("services/client/anotherParam"), null);
- Assert.assertFalse(Utils.checkForLog(logViewerClient, "anotherParam", 10),
+ Assert.assertFalse(logReader.checkForLog("anotherParam", 10),
" Target URL is wrong. It appends the context URL part also.");
+ logReader.stop();
}
@Test(groups = { "wso2.esb" }, description = "Sending a Message Via REST with additional resource")
@@ -52,16 +66,11 @@ public class RestPostFixUrlTest extends ESBIntegrationTest {
* & prameter - "foo"
* services/client/anotherParam/foo
*/
+ logReader.start();
HttpRequestUtil.sendGetRequest(getApiInvocationURL("services/client/anotherParam/foo"), null);
- Assert.assertTrue(Utils.checkForLog(logViewerClient, "/services/testAPI/foo", 10),
+ Assert.assertTrue(logReader.checkForLog("/services/testAPI/foo", 10),
" Target URL is wrong. expected /services/testAPI/foo ");
-
+ logReader.stop();
}
-
- @AfterClass(alwaysRun = true)
- public void destroy() throws Exception {
- super.cleanup();
- }
-
}
