本文整理汇总了Java中org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException类的典型用法代码示例。如果您正苦于以下问题:Java AutomationFrameworkException类的具体用法?Java AutomationFrameworkException怎么用?Java AutomationFrameworkException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AutomationFrameworkException类属于org.wso2.carbon.automation.engine.exceptions包,在下文中一共展示了AutomationFrameworkException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testResponseWith202
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
/**
* Test response with 202 and body is built by ESB and responds client
*
* @throws AxisFault in case of an axis2 level issue when sending
* @throws MalformedURLException in case of url is malformed
* @throws AutomationFrameworkException in case of any other test suite level issue
*/
@Test(groups = "wso2.esb", description = "Test response with 202 and body is built by ESB and responds client "
+ "properly")
public void testResponseWith202() throws AxisFault, MalformedURLException, AutomationFrameworkException {
Map<String, String> requestHeader = new HashMap<>();
requestHeader.put("Content-type", "text/xml");
requestHeader.put("SOAPAction", "urn:mediate");
String message = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap"
+ ".org/soap/envelope/\">\n"
+ " <soapenv:Header/>\n"
+ " <soapenv:Body/>\n"
+ "</soapenv:Envelope>";
HttpResponse response = HttpRequestUtil.
doPost(new URL(getProxyServiceURLHttp("mockProxy")), message, requestHeader);
Assert.assertTrue(response.getData().contains("Hello World"), "Expected response was not"
+ " received. Got " + response.getData());
}
示例2: testPayloadFactoryArgsWithTrailingSpaces
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
@Test(groups = "wso2.esb", description = "invoke service - Trailing space trim check")
public void testPayloadFactoryArgsWithTrailingSpaces()
throws AxisFault, MalformedURLException, AutomationFrameworkException {
//json request payload.
String payload = "{\n" +
" \"input\": { \"value\": \"<abc>sample</abc> \" }\n" +
"}";
Reader data = new StringReader(payload);
Writer writer = new StringWriter();
String serviceURL = this.getApiInvocationURL("trailingSpaceAPI");
String response = HttpURLConnectionClient.sendPostRequestAndReadResponse(data,
new URL(serviceURL), writer, "application/json");
assertNotNull(response, "Response is null");
//should return the response without throwing any errors.
assertTrue(response.contains("output\": \"{\"abc\":\"sample\"}"));
}
开发者ID:wso2,项目名称:product-ei,代码行数:22,代码来源:ESBJAVA5030PayloadFormatArgumentWithTrailingSpaceTestCase.java
示例3: testPayloadFactoryArgsWithXmlBeginAndEndTags
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
@Test(groups = "wso2.esb", description = "invoke service - EvaluatorCheck")
public void testPayloadFactoryArgsWithXmlBeginAndEndTags()
throws AxisFault, MalformedURLException, AutomationFrameworkException {
// json request payload.
String payload = "{\n" +
" \"input\": { \"value\": \"<ta>&[email protected]%*\\\"\\\" '>\" }\n" +
"}";
Reader data = new StringReader(payload);
Writer writer = new StringWriter();
String serviceURL = this.getApiInvocationURL("deepCheckAPI");
String response = HttpURLConnectionClient.sendPostRequestAndReadResponse(data,
new URL(serviceURL), writer, "application/json");
assertNotNull(response, "Response is null");
//should return the response without throwing any errors.
assertTrue(response.contains("\"output\": \"<ta>&[email protected]%*\\\"\\\" '>\""));
}
示例4: testForeachMediatorMessageFlow
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
/**
* Send a empty SOAP message and see if we get expected reply.
*
* @throws AxisFault in case of an axis2 level issue when sending
* @throws MalformedURLException in case of url is malformed
* @throws AutomationFrameworkException in case of any other test suite level issue
*/
@Test(groups = "wso2.esb", description = "Test call mediator with foreach mediator has expected message flow")
public void testForeachMediatorMessageFlow() throws AxisFault, MalformedURLException, AutomationFrameworkException {
Map<String, String> requestHeader = new HashMap<>();
requestHeader.put("Content-type", "text/xml");
requestHeader.put("SOAPAction", "urn:mediate");
String message = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap"
+ ".org/soap/envelope/\">\n"
+ " <soapenv:Header/>\n"
+ " <soapenv:Body/>\n"
+ "</soapenv:Envelope>";
HttpResponse response = HttpRequestUtil.
doPost(new URL(getProxyServiceURLHttp("acceptProxy")), message, requestHeader);
Assert.assertTrue(response.getData().contains("<company>wso2</company>"), "Expected response was not"
+ " received. Got " + response.getData());
}
示例5: testJsonResponseWithCacheMediator
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
@Test(groups = "wso2.esb",
description = "Test cache mediator with Json response having a single element array with PI enabled")
public void testJsonResponseWithCacheMediator() throws IOException, AutomationFrameworkException {
Map<String, String> requestHeader = new HashMap<>();
requestHeader.put("Content-type", "application/json");
//will not be a cache hit
HttpRequestUtil.doGet((getApiInvocationURL("cachingEnabledApi") + "/singleElementArrayBackend"), requestHeader);
//will be a cache hit
HttpResponse response = HttpRequestUtil.
doGet((getApiInvocationURL("cachingEnabledApi") + "/singleElementArrayBackend"), requestHeader);
//check if [] are preserved in response
Assert.assertTrue(response.getData().contains("[ \"water\" ]"),
"Expected response was not" + " received. Got " + response.getData());
}
示例6: testJsonResponseWithCacheMediator
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
@Test(groups = "wso2.esb", description = "Test cache mediator with Json response having a single element array", enabled = false)
public void testJsonResponseWithCacheMediator() throws IOException, AutomationFrameworkException {
Map<String, String> requestHeader = new HashMap<>();
requestHeader.put("Content-type", "application/json");
//will not be a cache hit
HttpRequestUtil.doGet((getApiInvocationURL("cachingEnabledApi") + "/singleElementArrayBackend"), requestHeader);
//will be a cache hit
HttpResponse response = HttpRequestUtil.
doGet((getApiInvocationURL("cachingEnabledApi") + "/singleElementArrayBackend"), requestHeader);
//check if [] are preserved in response
Assert.assertTrue(response.getData().contains("[ \"water\" ]"), "Expected response was not"
+ " received. Got " + response.getData());
}
示例7: testJSONFormattingInTenantMode
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
@Test(groups = "wso2.esb",
description = "Check whether JSON message formatting works properly in tenant mode")
public void testJSONFormattingInTenantMode() throws MalformedURLException, AutomationFrameworkException {
String JSON_PAYLOAD = "{\"emails\": [{\"value\": \"[email protected]om\"}]}";
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
HttpResponse response = HttpRequestUtil
.doPost(new URL("http://localhost:8480/json/payload"), JSON_PAYLOAD, headers);
//checking whether JSON payload of wrong format is received
assertFalse(response.getData().equals("{\"emails\":{\"value\":\"[email protected]\"}}"),
"Incorrect format received!");
//checking whether JSON payload of correct format is present
assertTrue(response.getData().equals("{\"emails\": [{\"value\": \"[email protected]\"}]}"),
"Expected format not received!");
}
示例8: checkPortAvailability
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
private int checkPortAvailability(Map<String, String> commandMap)
throws AutomationFrameworkException {
final int portOffset = getPortOffsetFromCommandMap(commandMap);
//check whether http port is already occupied
if (ClientConnectionUtil.isPortOpen(defaultHttpPort + portOffset)) {
throw new AutomationFrameworkException("Unable to start carbon server on port " +
(defaultHttpPort + portOffset) + " : Port already in use");
}
//check whether https port is already occupied
if (ClientConnectionUtil.isPortOpen(defaultHttpsPort + portOffset)) {
throw new AutomationFrameworkException("Unable to start carbon server on port " +
(defaultHttpsPort + portOffset) + " : Port already in use");
}
return portOffset;
}
示例9: generateCoverageReport
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
private void generateCoverageReport(File classesDir)
throws IOException, AutomationFrameworkException {
CodeCoverageUtils.executeMerge(FrameworkPathUtil.getJacocoCoverageHome(),
FrameworkPathUtil.getCoverageMergeFilePath());
ReportGenerator reportGenerator =
new ReportGenerator(new File(FrameworkPathUtil.getCoverageMergeFilePath()),
classesDir,
new File(CodeCoverageUtils.getJacocoReportDirectory()),
null);
reportGenerator.create();
log.info("Jacoco coverage dump file path : " + FrameworkPathUtil.getCoverageDumpFilePath());
log.info("Jacoco class file path : " + classesDir);
log.info("Jacoco coverage HTML report path : " + CodeCoverageUtils.getJacocoReportDirectory() + File.separator + "index.html");
}
示例10: startServer
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
/**
* This method is called for starting a Carbon server in preparation for execution of a
* TestSuite
* <p/>
* Add the @BeforeSuite TestNG annotation in the method overriding this method
*
* @return The CARBON_HOME
* @throws IOException If an error occurs while copying the deployment artifacts into the
* Carbon server
*/
public String startServer()
throws AutomationFrameworkException, IOException, XPathExpressionException {
if (carbonHome == null) {
if (carbonZip == null) {
carbonZip = System.getProperty(FrameworkConstants.SYSTEM_PROPERTY_CARBON_ZIP_LOCATION);
}
if (carbonZip == null) {
throw new IllegalArgumentException("carbon zip file cannot find in the given location");
}
carbonHome = carbonServer.setUpCarbonHome(carbonZip);
configureServer();
}
log.info("Carbon Home - " + carbonHome);
if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) {
this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND));
} else {
this.portOffset = 0;
}
if (commandMap.get("runtimePath") != null) {
this.runtimePath = commandMap.get("runtimePath");
}
carbonServer.startServerUsingCarbonHome(carbonHome, commandMap);
return carbonHome;
}
示例11: startServers
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
public void startServers(TestServerManager... serverManagers) throws AutomationFrameworkException {
TestServerManager[] arr$ = serverManagers;
int len$ = serverManagers.length;
for (int i$ = 0; i$ < len$; ++i$) {
TestServerManager zip = arr$[i$];
String carbonHome = null;
try {
carbonHome = zip.startServer();
} catch (IOException var8) {
throw new AutomationFrameworkException("Server start failed", var8);
} catch (AutomationFrameworkException var9) {
throw new AutomationFrameworkException("Server start failed", var9);
} catch (XPathExpressionException var10) {
throw new AutomationFrameworkException("Server start failed", var10);
}
this.servers.put(carbonHome, zip);
}
}
示例12: onExecutionStart
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
public void onExecutionStart() throws AutomationFrameworkException {
serverManager = new Axis2ServerManager();
//To set the socket can be bound even though a previous connection is still in a timeout state.
if (System.getProperty(CoreConnectionPNames.SO_REUSEADDR) == null) {
System.setProperty(CoreConnectionPNames.SO_REUSEADDR, "true");
}
try {
serverManager.start();
log.info(".................Deploying services..............");
serverManager.deployService(ServiceNameConstants.LB_SERVICE_1);
serverManager.deployService(ServiceNameConstants.SIMPLE_STOCK_QUOTE_SERVICE);
serverManager.deployService(ServiceNameConstants.SECURE_STOCK_QUOTE_SERVICE);
serverManager.deployService(ServiceNameConstants.SIMPLE_AXIS2_SERVICE);
} catch (IOException e) {
handleException("Error While Deploying services", e);
}
}
示例13: startServer
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
/**
* This method is called for starting a Carbon server in preparation for execution of a
* TestSuite
* <p/>
* Add the @BeforeSuite TestNG annotation in the method overriding this method
* @param server : The server which needs to be start.
* @return The CARBON_HOME
* @throws java.io.IOException If an error occurs while copying the deployment artifacts into the
* Carbon server
*/
public String startServer(String server)
throws AutomationFrameworkException, IOException, XPathExpressionException {
if(carbonHome == null) {
if (carbonZip == null) {
carbonZip = System.getProperty(FrameworkConstants.SYSTEM_PROPERTY_CARBON_ZIP_LOCATION);
}
if (carbonZip == null) {
throw new IllegalArgumentException("carbon zip file cannot find in the given location");
}
carbonHome = carbonServer.setUpCarbonHome(carbonZip) + "/" + server;
configureServer();
}
log.info("Carbon Home - " + carbonHome );
if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) {
this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND));
} else {
this.portOffset = 0;
}
carbonServer.startServerUsingCarbonHome(carbonHome, commandMap);
return carbonHome;
}
示例14: save
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
/**
* Merge all coverage data files and save it as single coverage data file.
*
* @param loader - coverage data file loader
* @throws AutomationFrameworkException - Throws if coverage data files cannot be created
*/
private static void save(final ExecFileLoader loader, String coverageMergeFilePath)
throws AutomationFrameworkException {
File destinationFile;
if (coverageMergeFilePath == null || coverageMergeFilePath.isEmpty()) {
destinationFile = new File(FrameworkPathUtil.getCoverageMergeFilePath());
} else {
destinationFile = new File(coverageMergeFilePath);
}
if (loader.getExecutionDataStore().getContents().isEmpty()) {
log.warn("Execution data is empty skipping coverage generation");
return;
}
log.info("Writing merged execution data to " + destinationFile.getAbsolutePath());
try {
loader.save(destinationFile, true);
} catch (IOException e) {
throw new AutomationFrameworkException("Unable to write merged file " +
destinationFile.getAbsolutePath(), e);
}
}
示例15: annotationComparator
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
private boolean annotationComparator(String annotation) throws AutomationFrameworkException {
boolean compSetup = false;
if (annotation.contains(ExecutionEnvironment.ALL.name())) {
compSetup = true;
} else {
try {
if (annotation.contains(ExecutionEnvironment.STANDALONE.name()) &&
annotation.toLowerCase().contains(context.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT))) {
compSetup = true;
} else if (annotation.contains(ExecutionEnvironment.PLATFORM.name()) &&
annotation.toLowerCase().contains(context.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT))) {
compSetup = true;
}
} catch (XPathExpressionException e) {
throw new AutomationFrameworkException("Error while reading" + ContextXpathConstants.EXECUTION_ENVIRONMENT + " from automation.xml ", e);
}
}
return compSetup;
}