Skip to content

Commit

Permalink
Merge pull request #3819 from GDLMadushanka/fixtest2
Browse files Browse the repository at this point in the history
Fix test failure
  • Loading branch information
GDLMadushanka authored Dec 9, 2024
2 parents e0df87e + c726962 commit 45aec21
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
import org.testng.annotations.Test;
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.clients.SimpleHttpClient;
import org.wso2.esb.integration.common.utils.common.ServerConfigurationManager;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -36,18 +39,28 @@ public class SynapseExpressionTestCase extends ESBIntegrationTest {

private CarbonLogReader carbonLogReader;
private static final String targetApiName = "synapseexpression_api";
private static final String CAPP_NAME = "SynapseExpressionTestCase_1.0.0.car";
private ServerConfigurationManager serverConfigurationManager;

@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {
super.init();
verifyAPIExistence(targetApiName);
serverConfigurationManager = new ServerConfigurationManager(context);
carbonLogReader = new CarbonLogReader();
carbonLogReader.start();
}

@Test(groups = "wso2.esb", description = "Testcase to test Synapse Expressions to fetch registry, registry " +
"property, path query and function params")
public void testSynapseExpressions() throws Exception {
File metadataCAPP = new File(
getESBResourceLocation() + File.separator + "synapseExpressions" + File.separator +
CAPP_NAME);
serverConfigurationManager.copyToCarbonapps(metadataCAPP);
assertTrue(Utils.checkForLog(carbonLogReader,
"API named 'SynapseExpression_api' has been deployed from file",20), "API Deployment failed");

String contentType = "application/json";
String payload = "{\"hello\": \"world\"}";
String url = getApiInvocationURL(targetApiName);
Expand Down Expand Up @@ -75,6 +88,7 @@ public void testSynapseExpressions() throws Exception {

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

0 comments on commit 45aec21

Please sign in to comment.