Skip to content

Commit

Permalink
Update testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaiyarasiganeshalingam committed Dec 2, 2024
1 parent eaf9b7d commit 98e1391
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,39 @@
import org.wso2.carbon.automation.test.utils.http.client.HttpRequestUtil;
import org.wso2.carbon.automation.test.utils.http.client.HttpResponse;
import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException;
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 org.wso2.esb.integration.common.utils.common.ServerConfigurationManager;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import static org.testng.Assert.assertTrue;

public class ApiWithConfigurablePropertyTestCase extends ESBIntegrationTest {

private ServerConfigurationManager serverConfigurationManager;

@BeforeClass(alwaysRun = true)
public void init() throws Exception {
super.init();
CarbonLogReader carbonLogReader = new CarbonLogReader();
carbonLogReader.start();
serverConfigurationManager = new ServerConfigurationManager(context);
File capp = new File(getESBResourceLocation() + File.separator + "config.var" + File.separator +
"testApiWithConfigurationProperty_1.0.0.car");
System.out.println(capp.getPath());
serverConfigurationManager.copyToCarbonapps(capp);
System.out.println("____________________________-");
System.out.println(carbonLogReader.getLogs());
System.out.println("____________________________-");
assertTrue(Utils.checkForLog(carbonLogReader,
"Successfully Deployed Carbon Application : testApiWithConfigurationProperty_1.0.0",
20), "Did not receive the expected info log");
}

@Test(groups = {"wso2.esb"}, description = "Configurable property", priority = 1)
Expand Down Expand Up @@ -102,6 +119,7 @@ public void testConfigurableProperty() throws IOException, AutomationUtilExcepti

@AfterClass(alwaysRun = true)
public void destroy() throws Exception {
serverConfigurationManager.removeFromCarbonapps("testApiWithConfigurationProperty_1.0.0.car");
super.cleanup();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,42 @@
import org.wso2.carbon.automation.test.utils.http.client.HttpRequestUtil;
import org.wso2.carbon.automation.test.utils.http.client.HttpResponse;
import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException;
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 org.wso2.esb.integration.common.utils.common.ServerConfigurationManager;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import static org.testng.Assert.assertTrue;

public class EndpointWithConfigurablePropertyTestCase extends ESBIntegrationTest {

private ServerConfigurationManager serverConfigurationManager;

@BeforeClass(alwaysRun = true)
public void init() throws Exception {
super.init();
CarbonLogReader carbonLogReader = new CarbonLogReader();
carbonLogReader.start();
serverConfigurationManager = new ServerConfigurationManager(context);
File capp = new File(getESBResourceLocation() + File.separator + "config.var" + File.separator +
"testConfiguration_1.0.0.car");
System.out.println("########################################################");
serverConfigurationManager.copyToCarbonapps(capp);
System.out.println(capp.getPath());
System.out.println("########################################################");
assertTrue(Utils.checkForLog(carbonLogReader, "Successfully Deployed Carbon Application : " +
"testConfiguration_1.0.0", 20), "Did not receive the expected info log");
}

@Test(groups = {"wso2.esb"}, description = "Configurable property", priority = 1)
public void testConfigurablePropertyWithFile() throws IOException {

Map<String, String> headers = new HashMap<>();
URL endpoint = new URL(getApiInvocationURL("getdata/file"));
HttpResponse httpResponse = HttpRequestUtil.doGet(endpoint.toString(), headers);
Expand Down Expand Up @@ -94,6 +110,7 @@ public void testConfigurableProperty() throws IOException, AutomationUtilExcepti

@AfterClass(alwaysRun = true)
public void destroy() throws Exception {
serverConfigurationManager.removeFromCarbonapps("testConfiguration_1.0.0.car");
super.cleanup();
}
}

0 comments on commit 98e1391

Please sign in to comment.