本文整理汇总了Java中org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException类的典型用法代码示例。如果您正苦于以下问题:Java AutomationFrameworkException类的具体用法?Java AutomationFrameworkException怎么用?Java AutomationFrameworkException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AutomationFrameworkException类属于org.wso2.carbon.automation.engine.exceptions包,在下文中一共展示了AutomationFrameworkException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
开发者ID:wso2,项目名称:product-ei,代码行数:26,代码来源:ESBJAVA5135ResponseBodyWith202TestCase.java
示例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]%*\\\"\\\" '>\""));
}
开发者ID:wso2,项目名称:product-ei,代码行数:23,代码来源:ESBJAVA3573PayloadFormatWithBeginHtmlTagArgument.java
示例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());
}
开发者ID:wso2,项目名称:product-ei,代码行数:25,代码来源:testInfiniteLoopingWithCallMediatorTestCase.java
示例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());
}
开发者ID:wso2,项目名称:product-ei,代码行数:19,代码来源:ESBJAVA4721PIWithCacheTestCase.java
示例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());
}
开发者ID:wso2,项目名称:product-ei,代码行数:18,代码来源:JsonResponseWithCacheTestCase.java
示例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!");
}
开发者ID:wso2,项目名称:product-ei,代码行数:18,代码来源:JSONPayloadProperFormatTenantModeTestCase.java
示例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;
}
开发者ID:wso2,项目名称:product-ei,代码行数:17,代码来源:CarbonServerManager.java
示例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");
}
开发者ID:wso2,项目名称:product-ei,代码行数:17,代码来源:CarbonServerManager.java
示例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;
}
开发者ID:wso2,项目名称:product-ei,代码行数:36,代码来源:TestServerManager.java
示例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);
}
}
开发者ID:wso2,项目名称:product-ei,代码行数:23,代码来源:MultipleServersManager.java
示例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);
}
}
开发者ID:wso2,项目名称:product-ei,代码行数:18,代码来源:Axis2ServerExtension.java
示例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;
}
开发者ID:wso2,项目名称:product-iots,代码行数:32,代码来源:CustomTestServerManager.java
示例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);
}
}
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:31,代码来源:CodeCoverageUtils.java
示例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;
}
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:21,代码来源:TestTransformerListener.java
示例16: waitForServiceUnDeployment
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
public static void waitForServiceUnDeployment(String serviceUrl) throws AutomationFrameworkException {
int serviceTimeOut = 0;
try {
while (isServiceAvailable(serviceUrl)) {
if (serviceTimeOut == 0) {
} else if (serviceTimeOut > 60) { //Check for the service for 100 seconds
throw new AutomationFrameworkException("Service undeployment fail");
}
try {
Thread.sleep(500);
serviceTimeOut++;
} catch (InterruptedException ignored) {
}
}
} catch (IOException e) {
log.error("Service not available " , e);
throw new AutomationFrameworkException("Service not available " , e);
}
}
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:20,代码来源:AxisServiceClientUtils.java
示例17: doPost
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
public void doPost(String endpoint, String queryString, String contentType) throws AutomationFrameworkException {
String charset = "UTF-8";
try {
if (contentType == null || "".equals(contentType)) {
contentType = "application/json";
}
HttpURLConnection conn = (HttpURLConnection) new URL(endpoint).openConnection();
conn.setRequestProperty(GenericJSONClient.HEADER_CONTENT_TYPE, contentType);
conn.setRequestProperty(GenericJSONClient.HEADER_ACCEPT_CHARSET, charset);
conn.setRequestMethod("POST");
conn.setDoOutput(true);
OutputStream os = conn.getOutputStream();
os.write(queryString.getBytes(charset));
os.flush();
os.close();
int responseCode = conn.getResponseCode();
conn.getInputStream().close();
if (responseCode != 202) {
throw new AutomationFrameworkException("Server responded with an inappropriate response code : '" +
responseCode + "'");
}
} catch (IOException e) {
throw new AutomationFrameworkException("Error occurred while executing the GET operation", e);
}
}
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:26,代码来源:GenericJSONClient.java
示例18: sendDeleteRequest
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
/**
* Sends an HTTP DELETE request to a url
*
* @param endpoint - The URL of the server. (Example: " http://www.yahoo.com/search")
* @param contentType - content type of the message
* @return - The response code from the endpoint
* @throws java.io.IOException If an error occurs while sending the DELETE request
*/
public static int sendDeleteRequest(URL endpoint, String contentType) throws AutomationFrameworkException {
HttpURLConnection urlConnection = null;
int responseCode;
try {
urlConnection = (HttpURLConnection)endpoint.openConnection();
try {
urlConnection.setRequestMethod("DELETE");
} catch (ProtocolException var33) {
throw new AutomationFrameworkException(
"Shouldn\'t happen: HttpURLConnection doesn\'t support DELETE?? " + var33.getMessage(), var33);
}
urlConnection.setDoOutput(true);
urlConnection.setRequestProperty("Content-type", contentType);
responseCode = urlConnection.getResponseCode();
} catch (IOException var36) {
throw new AutomationFrameworkException(
"Connection error (is server running at " + endpoint + " ?): " + var36.getMessage(), var36);
} finally {
if(urlConnection != null) {
urlConnection.disconnect();
}
}
return responseCode;
}
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:34,代码来源:HttpRequestUtil.java
示例19: executeMe
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
private JMeterResult executeMe() throws AutomationFrameworkException {
try {
addLogFile(testFile.getName());
} catch (IOException e) {
throw new AutomationFrameworkException("Can't add log file " + e.getMessage(), e);
}
Boolean resultState = true;
JMeterResult results;
String resultFile = executeTest(testFile);
try {
// Force shutdown
StandardJMeterEngine.stopEngineNow();
ShutdownClient.main(new String[]{"Shutdown"});
} catch (IOException ex) {
log.error(ex);
resultState = false;
}
results = resultValidator(resultFile);
results.setFileName(resultFile);
results.setExecutionState(resultState);
return results;
}
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:27,代码来源:JMeterTestManager.java
示例20: checkForErrors
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; //导入依赖的package包/类
private void checkForErrors() throws AutomationFrameworkException, IOException {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(
new FileInputStream(jmeterLogFile), Charset.defaultCharset()));
String line;
while ((line = in.readLine()) != null) {
if (PAT_ERROR.matcher(line).find()) {
throw new AutomationFrameworkException("There were test errors, see logfile '" + jmeterLogFile + "' for further information");
}
}
in.close();
} catch (IOException e) {
throw new IOException("Can't read log file", e);
}
}
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:17,代码来源:JMeterTestManager.java
注:本文中的org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论