mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Formatted again after all the tab expansions and eol removals
This commit is contained in:
parent
224f479974
commit
eaa250fd3c
2
pom.xml
2
pom.xml
@ -445,7 +445,6 @@
|
||||
<outputDirectory>${basedir}/${cs.target.dir}/classes</outputDirectory>
|
||||
<testOutputDirectory>${basedir}/${cs.target.dir}/test-classes</testOutputDirectory>
|
||||
<plugins>
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
@ -475,7 +474,6 @@
|
||||
<excludes>**\/target\/,**\/bin\/,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
|
||||
@ -53,63 +53,73 @@ public enum Config {
|
||||
"alert.smtp.password",
|
||||
null,
|
||||
"Password for SMTP authentication (applies only if alert.smtp.useAuth is true).",
|
||||
null), AlertSMTPPort("Alert", ManagementServer.class, Integer.class, "alert.smtp.port", "465", "Port the SMTP server is listening on.", null), AlertSMTPUseAuth(
|
||||
null),
|
||||
AlertSMTPPort("Alert", ManagementServer.class, Integer.class, "alert.smtp.port", "465", "Port the SMTP server is listening on.", null),
|
||||
AlertSMTPUseAuth(
|
||||
"Alert",
|
||||
ManagementServer.class,
|
||||
String.class,
|
||||
"alert.smtp.useAuth",
|
||||
null,
|
||||
"If true, use SMTP authentication when sending emails.",
|
||||
null), AlertSMTPUsername(
|
||||
null),
|
||||
AlertSMTPUsername(
|
||||
"Alert",
|
||||
ManagementServer.class,
|
||||
String.class,
|
||||
"alert.smtp.username",
|
||||
null,
|
||||
"Username for SMTP authentication (applies only if alert.smtp.useAuth is true).",
|
||||
null), CapacityCheckPeriod(
|
||||
null),
|
||||
CapacityCheckPeriod(
|
||||
"Alert",
|
||||
ManagementServer.class,
|
||||
Integer.class,
|
||||
"capacity.check.period",
|
||||
"300000",
|
||||
"The interval in milliseconds between capacity checks",
|
||||
null), PublicIpCapacityThreshold(
|
||||
null),
|
||||
PublicIpCapacityThreshold(
|
||||
"Alert",
|
||||
ManagementServer.class,
|
||||
Float.class,
|
||||
"zone.virtualnetwork.publicip.capacity.notificationthreshold",
|
||||
"0.75",
|
||||
"Percentage (as a value between 0 and 1) of public IP address space utilization above which alerts will be sent.",
|
||||
null), PrivateIpCapacityThreshold(
|
||||
null),
|
||||
PrivateIpCapacityThreshold(
|
||||
"Alert",
|
||||
ManagementServer.class,
|
||||
Float.class,
|
||||
"pod.privateip.capacity.notificationthreshold",
|
||||
"0.75",
|
||||
"Percentage (as a value between 0 and 1) of private IP address space utilization above which alerts will be sent.",
|
||||
null), SecondaryStorageCapacityThreshold(
|
||||
null),
|
||||
SecondaryStorageCapacityThreshold(
|
||||
"Alert",
|
||||
ManagementServer.class,
|
||||
Float.class,
|
||||
"zone.secstorage.capacity.notificationthreshold",
|
||||
"0.75",
|
||||
"Percentage (as a value between 0 and 1) of secondary storage utilization above which alerts will be sent about low storage available.",
|
||||
null), VlanCapacityThreshold(
|
||||
null),
|
||||
VlanCapacityThreshold(
|
||||
"Alert",
|
||||
ManagementServer.class,
|
||||
Float.class,
|
||||
"zone.vlan.capacity.notificationthreshold",
|
||||
"0.75",
|
||||
"Percentage (as a value between 0 and 1) of Zone Vlan utilization above which alerts will be sent about low number of Zone Vlans.",
|
||||
null), DirectNetworkPublicIpCapacityThreshold(
|
||||
null),
|
||||
DirectNetworkPublicIpCapacityThreshold(
|
||||
"Alert",
|
||||
ManagementServer.class,
|
||||
Float.class,
|
||||
"zone.directnetwork.publicip.capacity.notificationthreshold",
|
||||
"0.75",
|
||||
"Percentage (as a value between 0 and 1) of Direct Network Public Ip Utilization above which alerts will be sent about low number of direct network public ips.",
|
||||
null), LocalStorageCapacityThreshold(
|
||||
null),
|
||||
LocalStorageCapacityThreshold(
|
||||
"Alert",
|
||||
ManagementServer.class,
|
||||
Float.class,
|
||||
|
||||
@ -32,7 +32,6 @@ import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpMethod;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
@ -97,7 +96,8 @@ public class UserCloudAPIExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Constructing API call to host = '" + host + "' with API command = '" + apiUrl + "' using apiKey = '" + apiKey + "' and secretKey = '" + secretKey + "'");
|
||||
System.out.println("Constructing API call to host = '" + host + "' with API command = '" + apiUrl + "' using apiKey = '" + apiKey + "' and secretKey = '" + secretKey +
|
||||
"'");
|
||||
|
||||
// Step 1: Make sure your APIKey is URL encoded
|
||||
String encodedApiKey = URLEncoder.encode(apiKey, "UTF-8");
|
||||
|
||||
@ -21,10 +21,8 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
public class BuildGuestNetwork {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(BuildGuestNetwork.class.getClass());
|
||||
@ -36,8 +34,6 @@ public class BuildGuestNetwork {
|
||||
private static long templateId = 3;
|
||||
private static long serviceOfferingId = 1;
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
@ -124,5 +120,4 @@ public class BuildGuestNetwork {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -25,7 +25,6 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpMethod;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
@ -33,8 +32,6 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.test.stress.TestClientWithAPI;
|
||||
|
||||
|
||||
|
||||
public class PerformanceWithAPI {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(PerformanceWithAPI.class.getClass());
|
||||
@ -47,8 +44,6 @@ private static final long _serviceOfferingId=1;
|
||||
private static final String _apiUrl = "/client/api";
|
||||
private static final int _developerPort = 8080;
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
@ -112,7 +107,6 @@ private static final int _developerPort=8080;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//get public IP address for the User
|
||||
myUser.retrievePublicIp(_zoneId);
|
||||
singlePublicIp = myUser.getPublicIp().get(myUser.getPublicIp().size() - 1);
|
||||
@ -124,7 +118,6 @@ private static final int _developerPort=8080;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//create ForwardProxy rules for user's VMs
|
||||
int responseCode = CreateForwardingRule(myUser, singlePrivateIp, singlePublicIp, "22", "22");
|
||||
if (responseCode == 500)
|
||||
@ -134,11 +127,12 @@ private static final int _developerPort=8080;
|
||||
s_logger.info("Deployment successful..." + numVM + " VMs were created. Waiting for 5 min before performance test");
|
||||
Thread.sleep(300000L); // Wait
|
||||
|
||||
|
||||
//Start performance test for the user
|
||||
s_logger.info("Starting performance test for Guest network that has " + myUser.getPublicIp().size() + " public IP addresses");
|
||||
for (int j = 0; j < myUser.getPublicIp().size(); j++) {
|
||||
s_logger.info("Starting test for user which has "+myUser.getVirtualMachines().size()+" vms. Public IP for the user is "+myUser.getPublicIp().get(j)+" , number of retries is "+_retry+" , private IP address of the machine is"+myUser.getVirtualMachines().get(j).getPrivateIp());
|
||||
s_logger.info("Starting test for user which has " + myUser.getVirtualMachines().size() + " vms. Public IP for the user is " +
|
||||
myUser.getPublicIp().get(j) + " , number of retries is " + _retry + " , private IP address of the machine is" +
|
||||
myUser.getVirtualMachines().get(j).getPrivateIp());
|
||||
guestNetwork myNetwork = new guestNetwork(myUser.getPublicIp().get(j), _retry);
|
||||
myNetwork.setVirtualMachines(myUser.getVirtualMachines());
|
||||
new Thread(myNetwork).start();
|
||||
@ -162,7 +156,6 @@ private static final int _developerPort=8080;
|
||||
String encodedApiKey = URLEncoder.encode(myUser.getApiKey(), "UTF-8");
|
||||
int responseCode = 500;
|
||||
|
||||
|
||||
String requestToSign = "apiKey=" + encodedApiKey
|
||||
+ "&command=createOrUpdateIpForwardingRule&privateIp="
|
||||
+ encodedPrivateIp + "&privatePort=" + encodedPrivatePort
|
||||
@ -205,5 +198,4 @@ private static final int _developerPort=8080;
|
||||
return responseCode;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -15,6 +15,7 @@
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.test.longrun;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.io.InputStream;
|
||||
@ -29,8 +30,6 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.test.stress.TestClientWithAPI;
|
||||
|
||||
|
||||
|
||||
public class User {
|
||||
public static final Logger s_logger = Logger.getLogger(User.class.getClass());
|
||||
|
||||
@ -45,7 +44,6 @@ public class User {
|
||||
private String password;
|
||||
private String encryptedPassword;
|
||||
|
||||
|
||||
public User(String userName, String password, String server, String developerServer)
|
||||
{
|
||||
this.server = server;
|
||||
@ -60,56 +58,42 @@ public class User {
|
||||
return virtualMachines;
|
||||
}
|
||||
|
||||
|
||||
public void setVirtualMachines(ArrayList<VirtualMachine> virtualMachines) {
|
||||
this.virtualMachines = virtualMachines;
|
||||
}
|
||||
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<String> getPublicIp() {
|
||||
return publicIp;
|
||||
}
|
||||
|
||||
|
||||
public void setPublicIp(ArrayList<String> publicIp) {
|
||||
this.publicIp = publicIp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setServer(String server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
@ -134,8 +118,6 @@ public class User {
|
||||
this.secretKey = secretKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getDeveloperServer() {
|
||||
return developerServer;
|
||||
}
|
||||
@ -234,5 +216,3 @@ public class User {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -27,42 +27,34 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.test.stress.TestClientWithAPI;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class VirtualMachine {
|
||||
public static final Logger s_logger = Logger.getLogger(VirtualMachine.class.getClass());
|
||||
|
||||
private String privateIp;
|
||||
private String userId;
|
||||
|
||||
|
||||
public VirtualMachine(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
|
||||
public String getPrivateIp() {
|
||||
return privateIp;
|
||||
}
|
||||
|
||||
|
||||
public void setPrivateIp(String privateIp) {
|
||||
this.privateIp = privateIp;
|
||||
}
|
||||
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
|
||||
public void deployVM(long zoneId, long serviceOfferingId, long templateId, String server, String apiKey, String secretKey) throws IOException {
|
||||
|
||||
String encodedZoneId = URLEncoder.encode("" + zoneId, "UTF-8");
|
||||
@ -111,6 +103,4 @@ public class VirtualMachine {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.test.longrun;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -22,7 +23,6 @@ import org.apache.log4j.NDC;
|
||||
import com.trilead.ssh2.Connection;
|
||||
import com.trilead.ssh2.Session;
|
||||
|
||||
|
||||
public class guestNetwork implements Runnable {
|
||||
public static final Logger s_logger = Logger.getLogger(guestNetwork.class.getClass());
|
||||
|
||||
|
||||
@ -580,7 +580,8 @@ public class ApiCommand {
|
||||
continue;
|
||||
}
|
||||
if (!(verifyParam.get(key).equals("no value")) && !(itemNameElement.getTextContent().equals(verifyParam.get(key)))) {
|
||||
s_logger.error("Incorrect value for the following tag: " + key + ". Expected value is " + verifyParam.get(key) + " while actual value is " + itemNameElement.getTextContent());
|
||||
s_logger.error("Incorrect value for the following tag: " + key + ". Expected value is " + verifyParam.get(key) + " while actual value is " +
|
||||
itemNameElement.getTextContent());
|
||||
result = false;
|
||||
}
|
||||
} else {
|
||||
@ -612,7 +613,8 @@ public class ApiCommand {
|
||||
if ((itemName.getLength() != 0) && (itemName != null)) {
|
||||
Element itemNameElement = (Element)itemName.item(0);
|
||||
if (!(verifyParam.get(key).equals("no value")) && !(itemNameElement.getTextContent().equals(verifyParam.get(key)))) {
|
||||
s_logger.error("Incorrect value for the following tag: " + key + ". Expected value is " + verifyParam.get(key) + " while actual value is " + itemNameElement.getTextContent());
|
||||
s_logger.error("Incorrect value for the following tag: " + key + ". Expected value is " + verifyParam.get(key) + " while actual value is " +
|
||||
itemNameElement.getTextContent());
|
||||
result = false;
|
||||
}
|
||||
} else {
|
||||
@ -715,7 +717,8 @@ public class ApiCommand {
|
||||
fail++;
|
||||
} else if (expected.compareTo(actual) != 0) {
|
||||
fail++;
|
||||
s_logger.info("Amount of events of " + type + " type and level " + level + " is incorrect. Expected number of these events is " + expected + ", actual number is " + actual);
|
||||
s_logger.info("Amount of events of " + type + " type and level " + level + " is incorrect. Expected number of these events is " + expected +
|
||||
", actual number is " + actual);
|
||||
}
|
||||
}
|
||||
if (fail == 0) {
|
||||
@ -778,7 +781,8 @@ public class ApiCommand {
|
||||
}
|
||||
else if (expected.compareTo(actual) != 0) {
|
||||
fail++;
|
||||
s_logger.info("Amount of events of " + type + " type and level " + level + " is incorrect. Expected number of these events is " + expected + ", actual number is " + actual);
|
||||
s_logger.info("Amount of events of " + type + " type and level " + level + " is incorrect. Expected number of these events is " + expected +
|
||||
", actual number is " + actual);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,6 @@ import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
|
||||
import com.cloud.test.regression.ApiCommand.ResponseType;
|
||||
import com.trilead.ssh2.Connection;
|
||||
import com.trilead.ssh2.Session;
|
||||
@ -50,7 +49,6 @@ public class ConfigTest extends TestCase{
|
||||
//new command
|
||||
ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
|
||||
|
||||
|
||||
if (api.getName().equals("rebootManagementServer")) {
|
||||
|
||||
s_logger.info("Attempting to SSH into management server " + this.getParam().get("hostip"));
|
||||
@ -85,16 +83,17 @@ public class ConfigTest extends TestCase{
|
||||
//send a command
|
||||
api.sendCommand(this.getClient(), null);
|
||||
|
||||
|
||||
//verify the response of the command
|
||||
if ((api.getResponseType() == ResponseType.ERROR) && (api.getResponseCode() == 200) && (api.getTestCaseInfo() != null)) {
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + "failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + "failed. Command that was supposed to fail, passed. The command was sent with the following url " +
|
||||
api.getUrl());
|
||||
error++;
|
||||
}
|
||||
else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
//set parameters for the future use
|
||||
if (api.setParam(this.getParam()) == false) {
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " +
|
||||
api.getUrl());
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
@ -111,7 +110,8 @@ public class ConfigTest extends TestCase{
|
||||
}
|
||||
}
|
||||
else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() != 200)) {
|
||||
s_logger.error("Command " + api.getName() + " failed with an error code " + api.getResponseCode() + " . Command was sent with url " + api.getUrl() + " Required: " + api.getRequired());
|
||||
s_logger.error("Command " + api.getName() + " failed with an error code " + api.getResponseCode() + " . Command was sent with url " + api.getUrl() +
|
||||
" Required: " + api.getRequired());
|
||||
if (api.getRequired() == true) {
|
||||
s_logger.info("The command is required for the future use, so exiging");
|
||||
return false;
|
||||
@ -119,7 +119,8 @@ public class ConfigTest extends TestCase{
|
||||
error++;
|
||||
}
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed. Command that was supposed to fail, failed - test passed. Command was sent with url " + api.getUrl());
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed. Command that was supposed to fail, failed - test passed. Command was sent with url " +
|
||||
api.getUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package com.cloud.test.regression;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
@ -72,20 +71,23 @@ public static final Logger s_logger = Logger.getLogger(DelegatedAdminTest.class.
|
||||
|
||||
//verify the response of the command
|
||||
if ((verify == true) && !(api.getResponseType() == ResponseType.ERROR || api.getResponseType() == ResponseType.EMPTY)) {
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " +
|
||||
api.getUrl());
|
||||
error++;
|
||||
}
|
||||
else if ((verify == true) && (api.getResponseType() == ResponseType.ERROR || api.getResponseType() == ResponseType.EMPTY)) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
}
|
||||
else if ((api.getResponseType() == ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " +
|
||||
api.getUrl());
|
||||
error++;
|
||||
}
|
||||
else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
//set parameters for the future use
|
||||
if (api.setParam(this.getParam()) == false) {
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " +
|
||||
api.getUrl());
|
||||
return false;
|
||||
}
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
|
||||
@ -35,7 +35,6 @@ public class Deploy extends TestCase{
|
||||
this.setParam(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
|
||||
public boolean executeTest() {
|
||||
int error = 0;
|
||||
Element rootElement = this.getInputFile().get(0).getDocumentElement();
|
||||
@ -52,7 +51,6 @@ public class Deploy extends TestCase{
|
||||
//send a command
|
||||
api.sendCommand(this.getClient(), null);
|
||||
|
||||
|
||||
//verify the response of the command
|
||||
if (api.getResponseCode() != 200) {
|
||||
error++;
|
||||
@ -68,7 +66,6 @@ public class Deploy extends TestCase{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
@ -111,4 +108,3 @@ public class Deploy extends TestCase{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,6 @@ import com.trilead.ssh2.Session;
|
||||
public class EventsApiTest extends TestCase {
|
||||
public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getName());
|
||||
|
||||
|
||||
public EventsApiTest() {
|
||||
this.setClient();
|
||||
this.setParam(new HashMap<String, String>());
|
||||
@ -42,13 +41,11 @@ public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getNa
|
||||
Element rootElement = this.getInputFile().get(0).getDocumentElement();
|
||||
NodeList commandLst = rootElement.getElementsByTagName("command");
|
||||
|
||||
|
||||
//Analyze each command, send request and build the array list of api commands
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
|
||||
//!!!check if we need to execute mySql command
|
||||
NodeList commandName = fstElmnt.getElementsByTagName("name");
|
||||
Element commandElmnt = (Element)commandName.item(0);
|
||||
@ -114,10 +111,10 @@ public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getNa
|
||||
//send a command
|
||||
api.sendCommand(this.getClient(), null);
|
||||
|
||||
|
||||
//verify the response of the command
|
||||
if ((api.getResponseType() == ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " +
|
||||
api.getUrl());
|
||||
error++;
|
||||
}
|
||||
else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
@ -135,7 +132,8 @@ public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getNa
|
||||
else {
|
||||
//set parameters for the future use
|
||||
if (api.setParam(this.getParam()) == false) {
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
|
||||
s_logger.error("Exiting the test...Command " + api.getName() +
|
||||
" didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
|
||||
return false;
|
||||
}
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
@ -162,14 +160,15 @@ public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getNa
|
||||
//verify events with userid parameter - test case 97
|
||||
HashMap<String, Integer> expectedEvents = new HashMap<String, Integer>();
|
||||
expectedEvents.put("VM.START", 1);
|
||||
boolean eventResult = ApiCommand.verifyEvents(expectedEvents, "INFO", "http://" + this.getParam().get("hostip") + ":8096", "userid=" + this.getParam().get("userid1") + "&type=VM.START");
|
||||
boolean eventResult = ApiCommand.verifyEvents(expectedEvents, "INFO", "http://" + this.getParam().get("hostip") + ":8096", "userid=" + this.getParam().get("userid1") +
|
||||
"&type=VM.START");
|
||||
s_logger.info("Test case 97 - listEvent command verification result is " + eventResult);
|
||||
|
||||
//verify error events
|
||||
eventResult = ApiCommand.verifyEvents("../metadata/error_events.properties", "ERROR", "http://" + this.getParam().get("hostip") + ":8096", this.getParam().get("erroruseraccount"));
|
||||
eventResult = ApiCommand.verifyEvents("../metadata/error_events.properties", "ERROR", "http://" + this.getParam().get("hostip") + ":8096",
|
||||
this.getParam().get("erroruseraccount"));
|
||||
s_logger.info("listEvent command verification result is " + eventResult);
|
||||
|
||||
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
|
||||
@ -51,7 +51,8 @@ public class HA extends TestCase{
|
||||
//verify the response parameters
|
||||
if ((api.getResponseCode() != 200) && (api.getRequired() == true))
|
||||
{
|
||||
s_logger.error("Exiting the test....Command " + api.getName() + " required for the future run, failed with an error code " + api.getResponseCode() + ". Command was sent with the url " + api.getUrl());
|
||||
s_logger.error("Exiting the test....Command " + api.getName() + " required for the future run, failed with an error code " + api.getResponseCode() +
|
||||
". Command was sent with the url " + api.getUrl());
|
||||
return false;
|
||||
}
|
||||
else if ((api.getResponseCode() != 200) && (api.getResponseType() != ResponseType.ERROR)) {
|
||||
|
||||
@ -25,7 +25,6 @@ import org.w3c.dom.NodeList;
|
||||
|
||||
import com.cloud.test.regression.ApiCommand.ResponseType;
|
||||
|
||||
|
||||
public class LoadBalancingTest extends TestCase {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(LoadBalancingTest.class.getName());
|
||||
@ -53,10 +52,10 @@ public class LoadBalancingTest extends TestCase{
|
||||
//send a command
|
||||
api.sendCommand(this.getClient(), null);
|
||||
|
||||
|
||||
//verify the response of the command
|
||||
if ((api.getResponseType() == ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " +
|
||||
api.getUrl());
|
||||
error++;
|
||||
}
|
||||
else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
@ -74,7 +73,8 @@ public class LoadBalancingTest extends TestCase{
|
||||
else {
|
||||
//set parameters for the future use
|
||||
if (api.setParam(this.getParam()) == false) {
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " +
|
||||
api.getUrl());
|
||||
return false;
|
||||
}
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
@ -137,7 +137,6 @@ public class LoadBalancingTest extends TestCase{
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
|
||||
@ -51,10 +51,10 @@ public class PortForwardingTest extends TestCase{
|
||||
//send a command
|
||||
api.sendCommand(this.getClient(), null);
|
||||
|
||||
|
||||
//verify the response of the command
|
||||
if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " +
|
||||
api.getUrl());
|
||||
error++;
|
||||
}
|
||||
else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
@ -72,7 +72,8 @@ public class PortForwardingTest extends TestCase{
|
||||
else {
|
||||
//set parameters for the future use
|
||||
if (api.setParam(this.getParam()) == false) {
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " +
|
||||
api.getUrl());
|
||||
return false;
|
||||
}
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
@ -136,7 +137,6 @@ public class PortForwardingTest extends TestCase{
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
|
||||
@ -47,7 +47,8 @@ public class SanityTest extends TestCase{
|
||||
//verify the response parameters
|
||||
if ((api.getResponseCode() != 200) && (api.getRequired() == true))
|
||||
{
|
||||
s_logger.error("Exiting the test....Command " + api.getName() + " required for the future run, failed with an error code " + api.getResponseCode() + ". Command was sent with the url " + api.getUrl());
|
||||
s_logger.error("Exiting the test....Command " + api.getName() + " required for the future run, failed with an error code " + api.getResponseCode() +
|
||||
". Command was sent with the url " + api.getUrl());
|
||||
return false;
|
||||
}
|
||||
else if (api.getResponseCode() != 200) {
|
||||
@ -75,7 +76,8 @@ public class SanityTest extends TestCase{
|
||||
}
|
||||
|
||||
//verify event
|
||||
boolean eventResult = ApiCommand.verifyEvents("../metadata/func/regression_events.properties", "INFO", "http://" + this.getParam().get("hostip") + ":8096", this.getParam().get("accountname"));
|
||||
boolean eventResult = ApiCommand.verifyEvents("../metadata/func/regression_events.properties", "INFO", "http://" + this.getParam().get("hostip") + ":8096", this.getParam()
|
||||
.get("accountname"));
|
||||
s_logger.info("listEvent command verification result is " + eventResult);
|
||||
|
||||
if (error != 0)
|
||||
|
||||
@ -64,7 +64,8 @@ public class Test extends TestCase{
|
||||
for (String portValue : port) {
|
||||
try {
|
||||
s_logger.info("public port is " + portValue);
|
||||
String url = "http://" + this.getParam().get("hostip") + ":8096/?command=createNetworkRule&publicPort=" + portValue + "&privatePort=22&protocol=tcp&isForward=true&securityGroupId=1&account=admin";
|
||||
String url = "http://" + this.getParam().get("hostip") + ":8096/?command=createNetworkRule&publicPort=" + portValue +
|
||||
"&privatePort=22&protocol=tcp&isForward=true&securityGroupId=1&account=admin";
|
||||
HttpClient client = new HttpClient();
|
||||
HttpMethod method = new GetMethod(url);
|
||||
int responseCode = client.executeMethod(method);
|
||||
@ -77,7 +78,6 @@ public class Test extends TestCase{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
|
||||
@ -32,7 +32,6 @@ import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
|
||||
public abstract class TestCase {
|
||||
|
||||
public static Logger s_logger = Logger.getLogger(TestCase.class.getName());
|
||||
@ -51,7 +50,6 @@ public abstract class TestCase{
|
||||
this.param = param;
|
||||
}
|
||||
|
||||
|
||||
public HashMap<String, String> getCommands() {
|
||||
return commands;
|
||||
}
|
||||
|
||||
@ -25,11 +25,9 @@ import org.w3c.dom.NodeList;
|
||||
|
||||
import com.cloud.test.regression.ApiCommand.ResponseType;
|
||||
|
||||
|
||||
public class VMApiTest extends TestCase {
|
||||
public static final Logger s_logger = Logger.getLogger(VMApiTest.class.getName());
|
||||
|
||||
|
||||
public VMApiTest() {
|
||||
this.setClient();
|
||||
this.setParam(new HashMap<String, String>());
|
||||
@ -51,16 +49,17 @@ public static final Logger s_logger = Logger.getLogger(VMApiTest.class.getName()
|
||||
//send a command
|
||||
api.sendCommand(this.getClient(), this.getConn());
|
||||
|
||||
|
||||
//verify the response of the command
|
||||
if ((api.getResponseType() == ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
|
||||
s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " +
|
||||
api.getUrl());
|
||||
error++;
|
||||
}
|
||||
else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
|
||||
//set parameters for the future use
|
||||
if (api.setParam(this.getParam()) == false) {
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
|
||||
s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " +
|
||||
api.getUrl());
|
||||
return false;
|
||||
}
|
||||
//verify parameters
|
||||
|
||||
@ -87,7 +87,6 @@ public class StressTestDirectAttach {
|
||||
private static final int MAX_RETRY_LINUX = 10;
|
||||
private static final int MAX_RETRY_WIN = 10;
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String host = "http://localhost";
|
||||
String port = "8092";
|
||||
@ -160,8 +159,6 @@ public class StressTestDirectAttach {
|
||||
s_logger.info("Clean up is enabled, each test will wait "
|
||||
+ sleepTime + " ms before cleaning up");
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
@ -180,9 +177,6 @@ public class StressTestDirectAttach {
|
||||
boolean success = false;
|
||||
String reason = null;
|
||||
|
||||
|
||||
|
||||
|
||||
if (response == 200) {
|
||||
success = true;
|
||||
if (internet) {
|
||||
@ -196,7 +190,6 @@ public class StressTestDirectAttach {
|
||||
s_logger.info("Begin Linux SSH test for account " + _account.get());
|
||||
reason = sshTest(_linuxIP.get(), _linuxPassword.get());
|
||||
|
||||
|
||||
if (reason == null) {
|
||||
s_logger
|
||||
.info("Linux SSH test successful for account " + _account.get());
|
||||
@ -229,7 +222,8 @@ public class StressTestDirectAttach {
|
||||
|
||||
}
|
||||
else {
|
||||
s_logger.info("Skipping events and usage records for this user: usageIterator " + usageIterator+ " and number of Threads " + numThreads);
|
||||
s_logger.info("Skipping events and usage records for this user: usageIterator " + usageIterator + " and number of Threads " +
|
||||
numThreads);
|
||||
usageIterator++;
|
||||
}
|
||||
|
||||
@ -331,7 +325,6 @@ public class StressTestDirectAttach {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, List<String>> getMultipleValuesFromXML(
|
||||
InputStream is, String[] tagNames) {
|
||||
Map<String, List<String>> returnValues = new HashMap<String, List<String>>();
|
||||
@ -410,7 +403,6 @@ public class StressTestDirectAttach {
|
||||
return returnValues;
|
||||
}
|
||||
|
||||
|
||||
private static List<String> getNonSourceNatIPs(InputStream is) {
|
||||
List<String> returnValues = new ArrayList<String>();
|
||||
try {
|
||||
@ -558,7 +550,6 @@ public class StressTestDirectAttach {
|
||||
s_logger.info("got api key: " + _apiKey.get());
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------
|
||||
// CREATE NETWORK GROUP AND ADD INGRESS RULE TO IT
|
||||
// ---------------------------------
|
||||
@ -596,7 +587,6 @@ public class StressTestDirectAttach {
|
||||
return responseCode;
|
||||
}
|
||||
|
||||
|
||||
String encodedCidr = URLEncoder.encode("192.168.1.143/32", "UTF-8");
|
||||
url = server + "?command=authorizeSecurityGroupIngress&cidrlist=" + encodedCidr + "&endport=22&" +
|
||||
"securitygroupname=" + encodedUsername + "&protocol=tcp&startport=22&account=" + networkAccount + "&domainid=1";
|
||||
@ -621,8 +611,6 @@ public class StressTestDirectAttach {
|
||||
return responseCode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------------------
|
||||
// DEPLOY LINUX VM
|
||||
// ---------------------------------
|
||||
@ -673,8 +661,6 @@ public class StressTestDirectAttach {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Create a new volume
|
||||
{
|
||||
url = server + "?command=createVolume&diskofferingid=" + diskOfferingId + "&zoneid=" + zoneId + "&name=newvolume&account=" + _account.get() + "&domainid=1";
|
||||
@ -781,8 +767,6 @@ public class StressTestDirectAttach {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Create a new volume
|
||||
{
|
||||
url = server + "?command=createVolume&diskofferingid=" + diskOfferingId1 + "&zoneid=" + zoneId + "&name=newvolume1&account=" + _account.get() + "&domainid=1";
|
||||
@ -841,9 +825,6 @@ public class StressTestDirectAttach {
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static int executeCleanup(String server, String developerServer, String username)
|
||||
throws HttpException, IOException {
|
||||
// test steps:
|
||||
@ -1067,7 +1048,6 @@ public class StressTestDirectAttach {
|
||||
return responseCode;
|
||||
}
|
||||
|
||||
|
||||
private static int executeStop(String server, String developerServer,
|
||||
String username) throws HttpException, IOException {
|
||||
// test steps:
|
||||
@ -1148,13 +1128,11 @@ public class StressTestDirectAttach {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
s_logger.error("list virtual machines test failed with error code: " + responseCode + ". Following URL was sent: " + url);
|
||||
return responseCode;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// STOP/DESTROY VIRTUAL MACHINES
|
||||
// ----------------------------------
|
||||
@ -1203,7 +1181,6 @@ public class StressTestDirectAttach {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
_linuxIP.set("");
|
||||
@ -1400,7 +1377,6 @@ public class StressTestDirectAttach {
|
||||
InputStream stdout = sess.getStdout();
|
||||
InputStream stderr = sess.getStderr();
|
||||
|
||||
|
||||
byte[] buffer = new byte[8192];
|
||||
while (true) {
|
||||
if ((stdout.available() == 0) && (stderr.available() == 0)) {
|
||||
@ -1480,7 +1456,6 @@ public class StressTestDirectAttach {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static Element queryAsyncJobResult(String host, InputStream inputStream) {
|
||||
Element returnBody = null;
|
||||
|
||||
|
||||
@ -292,7 +292,8 @@ public class TestClientWithAPI {
|
||||
usageIterator = 1;
|
||||
|
||||
} else {
|
||||
s_logger.info("Skipping events and usage records for this user: usageIterator " + usageIterator + " and number of Threads " + numThreads);
|
||||
s_logger.info("Skipping events and usage records for this user: usageIterator " + usageIterator + " and number of Threads " +
|
||||
numThreads);
|
||||
usageIterator++;
|
||||
}
|
||||
|
||||
@ -334,7 +335,8 @@ public class TestClientWithAPI {
|
||||
s_logger.info("***** Completed test for user : " + username + " in " + ((System.currentTimeMillis() - now) / 1000L) + " seconds");
|
||||
|
||||
} else {
|
||||
s_logger.info("##### FAILED test for user : " + username + " in " + ((System.currentTimeMillis() - now) / 1000L) + " seconds with reason : " + reason);
|
||||
s_logger.info("##### FAILED test for user : " + username + " in " + ((System.currentTimeMillis() - now) / 1000L) + " seconds with reason : " +
|
||||
reason);
|
||||
}
|
||||
s_logger.info("Sleeping for " + wait + " seconds before starting next iteration");
|
||||
Thread.sleep(wait);
|
||||
@ -531,7 +533,8 @@ public class TestClientWithAPI {
|
||||
String encryptedPassword = createMD5Password(username);
|
||||
String encodedPassword = URLEncoder.encode(encryptedPassword, "UTF-8");
|
||||
|
||||
String url = server + "?command=createAccount&username=" + encodedUsername + "&account=" + encodedUsername + "&password=" + encodedPassword + "&firstname=Test&lastname=Test&email=test@vmops.com&domainId=1&accounttype=0";
|
||||
String url = server + "?command=createAccount&username=" + encodedUsername + "&account=" + encodedUsername + "&password=" + encodedPassword +
|
||||
"&firstname=Test&lastname=Test&email=test@vmops.com&domainId=1&accounttype=0";
|
||||
|
||||
HttpClient client = new HttpClient();
|
||||
HttpMethod method = new GetMethod(url);
|
||||
@ -552,7 +555,8 @@ public class TestClientWithAPI {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s_logger.error("create account test failed for account " + username + " with error code :" + responseCode + ", aborting deployment test. The command was sent with url " + url);
|
||||
s_logger.error("create account test failed for account " + username + " with error code :" + responseCode +
|
||||
", aborting deployment test. The command was sent with url " + url);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -576,7 +580,8 @@ public class TestClientWithAPI {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s_logger.error("list user test failed for account " + username + " with error code :" + responseCode + ", aborting deployment test. The command was sent with url " + url);
|
||||
s_logger.error("list user test failed for account " + username + " with error code :" + responseCode + ", aborting deployment test. The command was sent with url " +
|
||||
url);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -593,7 +598,8 @@ public class TestClientWithAPI {
|
||||
// ---------------------------------
|
||||
// CREATE VIRTUAL NETWORK
|
||||
// ---------------------------------
|
||||
url = server + "?command=createNetwork&networkofferingid=" + networkOfferingId + "&account=" + encodedUsername + "&domainId=1" + "&zoneId=" + zoneId + "&name=virtualnetwork-" + encodedUsername + "&displaytext=virtualnetwork-" + encodedUsername;
|
||||
url = server + "?command=createNetwork&networkofferingid=" + networkOfferingId + "&account=" + encodedUsername + "&domainId=1" + "&zoneId=" + zoneId +
|
||||
"&name=virtualnetwork-" + encodedUsername + "&displaytext=virtualnetwork-" + encodedUsername;
|
||||
client = new HttpClient();
|
||||
method = new GetMethod(url);
|
||||
responseCode = client.executeMethod(method);
|
||||
@ -606,7 +612,8 @@ public class TestClientWithAPI {
|
||||
_networkId.set(networkIdStr);
|
||||
}
|
||||
} else {
|
||||
s_logger.error("Create virtual network failed for account " + username + " with error code :" + responseCode + ", aborting deployment test. The command was sent with url " + url);
|
||||
s_logger.error("Create virtual network failed for account " + username + " with error code :" + responseCode +
|
||||
", aborting deployment test. The command was sent with url " + url);
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
@ -631,7 +638,6 @@ public class TestClientWithAPI {
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// ---------------------------------
|
||||
// DEPLOY LINUX VM
|
||||
// ---------------------------------
|
||||
@ -644,12 +650,14 @@ public class TestClientWithAPI {
|
||||
String encodedTemplateId = URLEncoder.encode("" + templateId, "UTF-8");
|
||||
String encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
|
||||
String encodedNetworkIds = URLEncoder.encode(_networkId.get() + ",206", "UTF-8");
|
||||
String requestToSign = "apikey=" + encodedApiKey + "&command=deployVirtualMachine&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds + "&serviceofferingid=" + encodedServiceOfferingId + "&templateid=" + encodedTemplateId
|
||||
String requestToSign = "apikey=" + encodedApiKey + "&command=deployVirtualMachine&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds +
|
||||
"&serviceofferingid=" + encodedServiceOfferingId + "&templateid=" + encodedTemplateId
|
||||
+ "&zoneid=" + encodedZoneId;
|
||||
requestToSign = requestToSign.toLowerCase();
|
||||
String signature = signRequest(requestToSign, _secretKey.get());
|
||||
String encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
url = developerServer + "?command=deployVirtualMachine" + "&zoneid=" + encodedZoneId + "&serviceofferingid=" + encodedServiceOfferingId + "&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds + "&templateid=" + encodedTemplateId
|
||||
url = developerServer + "?command=deployVirtualMachine" + "&zoneid=" + encodedZoneId + "&serviceofferingid=" + encodedServiceOfferingId + "&diskofferingid=" +
|
||||
diskOfferingId + "&networkids=" + encodedNetworkIds + "&templateid=" + encodedTemplateId
|
||||
+ "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
|
||||
|
||||
method = new GetMethod(url);
|
||||
@ -807,12 +815,14 @@ public class TestClientWithAPI {
|
||||
// -------------------------------------------------------------
|
||||
String encodedVmId = URLEncoder.encode(_linuxVmId.get(), "UTF-8");
|
||||
String encodedIpAddress = URLEncoder.encode(_linuxIpId.get(), "UTF-8");
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=createPortForwardingRule&ipaddressid=" + encodedIpAddress + "&privateport=22&protocol=TCP&publicport=22" + "&virtualmachineid=" + encodedVmId ;
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=createPortForwardingRule&ipaddressid=" + encodedIpAddress + "&privateport=22&protocol=TCP&publicport=22" +
|
||||
"&virtualmachineid=" + encodedVmId;
|
||||
requestToSign = requestToSign.toLowerCase();
|
||||
signature = signRequest(requestToSign, _secretKey.get());
|
||||
encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
|
||||
url = developerServer + "?command=createPortForwardingRule&apikey=" + encodedApiKey + "&ipaddressid=" + encodedIpAddress + "&privateport=22&protocol=TCP&publicport=22&virtualmachineid=" + encodedVmId + "&signature=" + encodedSignature;
|
||||
url = developerServer + "?command=createPortForwardingRule&apikey=" + encodedApiKey + "&ipaddressid=" + encodedIpAddress +
|
||||
"&privateport=22&protocol=TCP&publicport=22&virtualmachineid=" + encodedVmId + "&signature=" + encodedSignature;
|
||||
|
||||
s_logger.info("Created port forwarding rule with " + url);
|
||||
method = new GetMethod(url);
|
||||
@ -883,13 +893,15 @@ public class TestClientWithAPI {
|
||||
encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
|
||||
String encodedNetworkIds = URLEncoder.encode(_networkId.get() + ",206", "UTF-8");
|
||||
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=deployVirtualMachine&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds + "&serviceofferingid=" + encodedServiceOfferingId + "&templateid=" + encodedTemplateId
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=deployVirtualMachine&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds +
|
||||
"&serviceofferingid=" + encodedServiceOfferingId + "&templateid=" + encodedTemplateId
|
||||
+ "&zoneid=" + encodedZoneId;
|
||||
requestToSign = requestToSign.toLowerCase();
|
||||
signature = signRequest(requestToSign, _secretKey.get());
|
||||
encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
|
||||
url = developerServer + "?command=deployVirtualMachine" + "&zoneid=" + encodedZoneId + "&serviceofferingid=" + encodedServiceOfferingId + "&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds + "&templateid="
|
||||
url = developerServer + "?command=deployVirtualMachine" + "&zoneid=" + encodedZoneId + "&serviceofferingid=" + encodedServiceOfferingId + "&diskofferingid=" +
|
||||
diskOfferingId + "&networkids=" + encodedNetworkIds + "&templateid="
|
||||
+ encodedTemplateId + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
|
||||
|
||||
method = new GetMethod(url);
|
||||
@ -926,7 +938,8 @@ public class TestClientWithAPI {
|
||||
signature = signRequest(requestToSign, _secretKey.get());
|
||||
encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
|
||||
url = developerServer + "?command=enableStaticNat&apikey=" + encodedApiKey + "&ipaddressid=" + encodedPublicIpId + "&signature=" + encodedSignature + "&virtualMachineId=" + encodedVmId;
|
||||
url = developerServer + "?command=enableStaticNat&apikey=" + encodedApiKey + "&ipaddressid=" + encodedPublicIpId + "&signature=" + encodedSignature +
|
||||
"&virtualMachineId=" + encodedVmId;
|
||||
client = new HttpClient();
|
||||
method = new GetMethod(url);
|
||||
responseCode = client.executeMethod(method);
|
||||
@ -941,7 +954,6 @@ public class TestClientWithAPI {
|
||||
return responseCode;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// CREATE IP FORWARDING RULE -- Windows VM
|
||||
// -------------------------------------------------------------
|
||||
@ -955,7 +967,8 @@ public class TestClientWithAPI {
|
||||
signature = signRequest(requestToSign, _secretKey.get());
|
||||
encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
|
||||
url = developerServer + "?command=createIpForwardingRule&apikey=" + encodedApiKey + "&endPort=22&ipaddressid=" + encodedIpAddress + "&protocol=TCP&signature=" + encodedSignature + "&startPort=22";
|
||||
url = developerServer + "?command=createIpForwardingRule&apikey=" + encodedApiKey + "&endPort=22&ipaddressid=" + encodedIpAddress + "&protocol=TCP&signature=" +
|
||||
encodedSignature + "&startPort=22";
|
||||
|
||||
s_logger.info("Created Ip forwarding rule with " + url);
|
||||
method = new GetMethod(url);
|
||||
@ -1270,12 +1283,14 @@ public class TestClientWithAPI {
|
||||
}
|
||||
|
||||
// Create private template from root disk volume
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=createTemplate" + "&displaytext=" + _account.get() + "&name=" + _account.get() + "&ostypeid=11" + "&snapshotid=" + _snapshot.get();
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=createTemplate" + "&displaytext=" + _account.get() + "&name=" + _account.get() + "&ostypeid=11" + "&snapshotid=" +
|
||||
_snapshot.get();
|
||||
requestToSign = requestToSign.toLowerCase();
|
||||
signature = signRequest(requestToSign, _secretKey.get());
|
||||
encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
|
||||
url = developerServer + "?command=createTemplate" + "&displaytext=" + _account.get() + "&name=" + _account.get() + "&ostypeid=11" + "&snapshotid=" + _snapshot.get() + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
|
||||
url = developerServer + "?command=createTemplate" + "&displaytext=" + _account.get() + "&name=" + _account.get() + "&ostypeid=11" + "&snapshotid=" + _snapshot.get() +
|
||||
"&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
|
||||
client = new HttpClient();
|
||||
method = new GetMethod(url);
|
||||
responseCode = client.executeMethod(method);
|
||||
@ -1482,7 +1497,8 @@ public class TestClientWithAPI {
|
||||
s_logger.info("Network stat is correct for account" + _account.get() + "; bytest received is " + bytesReceived + " and bytes sent is " + bytesSent);
|
||||
return true;
|
||||
} else {
|
||||
s_logger.error("Incorrect value for bytes received/sent for the account " + _account.get() + ". We got " + bytesReceived + " bytes received; " + " and " + bytesSent + " bytes sent");
|
||||
s_logger.error("Incorrect value for bytes received/sent for the account " + _account.get() + ". We got " + bytesReceived + " bytes received; " + " and " +
|
||||
bytesSent + " bytes sent");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -34,8 +34,6 @@ public class WgetTest {
|
||||
public static String host = "";
|
||||
public static String password = "rs-ccb35ea5";
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// Parameters
|
||||
@ -105,7 +103,6 @@ public class WgetTest {
|
||||
InputStream stdout = sess.getStdout();
|
||||
InputStream stderr = sess.getStderr();
|
||||
|
||||
|
||||
byte[] buffer = new byte[8192];
|
||||
while (true) {
|
||||
if ((stdout.available() == 0) && (stderr.available() == 0)) {
|
||||
|
||||
@ -56,13 +56,17 @@ public class AddAndDeleteAISO extends AbstractSeleniumTestCase {
|
||||
System.out.println("i= " + i);
|
||||
selenium.click("//div[" + i + "]/div/div[2]/span/span");
|
||||
}
|
||||
}
|
||||
catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
for (int second = 0;; second++) {
|
||||
if (second >= 60) fail("timeout");
|
||||
try { if (selenium.isVisible("//div[@id='after_action_info_container_on_top']")) break; } catch (Exception e) {}
|
||||
if (second >= 60)
|
||||
fail("timeout");
|
||||
try {
|
||||
if (selenium.isVisible("//div[@id='after_action_info_container_on_top']"))
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Thread.sleep(10000);
|
||||
}
|
||||
|
||||
@ -96,8 +100,13 @@ public class AddAndDeleteAISO extends AbstractSeleniumTestCase {
|
||||
selenium.click("link=Delete ISO");
|
||||
selenium.click("//div[28]/div[11]/button[1]");
|
||||
for (int second = 0;; second++) {
|
||||
if (second >= 60) fail("timeout");
|
||||
try { if (selenium.isVisible("after_action_info_container_on_top")) break; } catch (Exception e) {}
|
||||
if (second >= 60)
|
||||
fail("timeout");
|
||||
try {
|
||||
if (selenium.isVisible("after_action_info_container_on_top"))
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
||||
|
||||
@ -55,13 +55,17 @@ public class AddAndDeleteATemplate extends AbstractSeleniumTestCase {
|
||||
System.out.println("i= " + i);
|
||||
selenium.click("//div[" + i + "]/div/div[2]/span/span");
|
||||
}
|
||||
}
|
||||
catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
for (int second = 0;; second++) {
|
||||
if (second >= 60) fail("timeout");
|
||||
try { if (selenium.isVisible("//div[@id='after_action_info_container_on_top']")) break; } catch (Exception e) {}
|
||||
if (second >= 60)
|
||||
fail("timeout");
|
||||
try {
|
||||
if (selenium.isVisible("//div[@id='after_action_info_container_on_top']"))
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Thread.sleep(10000);
|
||||
}
|
||||
|
||||
@ -95,8 +99,13 @@ public class AddAndDeleteATemplate extends AbstractSeleniumTestCase {
|
||||
selenium.click("link=Delete Template");
|
||||
selenium.click("//div[28]/div[11]/button[1]");
|
||||
for (int second = 0;; second++) {
|
||||
if (second >= 60) fail("timeout");
|
||||
try { if (selenium.isVisible("after_action_info_container_on_top")) break; } catch (Exception e) {}
|
||||
if (second >= 60)
|
||||
fail("timeout");
|
||||
try {
|
||||
if (selenium.isVisible("after_action_info_container_on_top"))
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
||||
|
||||
@ -22,9 +22,6 @@ import java.util.ArrayList;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
|
||||
|
||||
public class ProxyLoadTemp {
|
||||
public static final Logger s_logger = Logger.getLogger(ProxyLoadTemp.class.getClass());
|
||||
public static int numThreads = 0;
|
||||
@ -65,8 +62,7 @@ public class ProxyLoadTemp {
|
||||
new Thread(proxy).start();
|
||||
numThreads++;
|
||||
|
||||
}
|
||||
catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
s_logger.warn(ex);
|
||||
}
|
||||
}
|
||||
@ -80,9 +76,11 @@ public class ProxyLoadTemp {
|
||||
|
||||
public static class ShutdownThread extends Thread {
|
||||
ProxyLoadTemp temp;
|
||||
|
||||
public ShutdownThread(ProxyLoadTemp temp) {
|
||||
this.temp = temp;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
s_logger.info("Program was running in " + numThreads + " threads");
|
||||
|
||||
@ -91,7 +89,8 @@ public class ProxyLoadTemp {
|
||||
if (proxyList.get(j).getConnectionsMade() != 0) {
|
||||
av = proxyList.get(j).getResponseTime() / proxyList.get(j).getConnectionsMade();
|
||||
}
|
||||
s_logger.info("Information for "+j+" thread: Number of requests sent is "+proxyList.get(j).getConnectionsMade()+". Average response time is "+av+" milliseconds");
|
||||
s_logger.info("Information for " + j + " thread: Number of requests sent is " + proxyList.get(j).getConnectionsMade() + ". Average response time is " + av +
|
||||
" milliseconds");
|
||||
sum = sum + av;
|
||||
|
||||
}
|
||||
@ -101,7 +100,6 @@ public class ProxyLoadTemp {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String[] parseLine(String line, String del) throws Exception
|
||||
{
|
||||
String del1 = del.substring(1, del.length() - 1);
|
||||
@ -117,5 +115,4 @@ public class ProxyLoadTemp {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -40,7 +40,6 @@ public class SignEC2 {
|
||||
public static final Logger s_logger = Logger
|
||||
.getLogger(SignRequest.class.getName());
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Parameters
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
@ -65,7 +64,6 @@ public class SignEC2 {
|
||||
secretkey = prop.getProperty("secretkey");
|
||||
port = prop.getProperty("port");
|
||||
|
||||
|
||||
if (host == null) {
|
||||
s_logger.info("Please set host in tool.properties file");
|
||||
System.exit(1);
|
||||
@ -96,8 +94,6 @@ public class SignEC2 {
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TreeMap<String, String> param = new TreeMap<String, String>();
|
||||
|
||||
String req = "GET\n" + host + ":" + prop.getProperty("port") + "\n/" + prop.getProperty("accesspoint") + "\n";
|
||||
|
||||
@ -31,7 +31,6 @@ public class SignRequest {
|
||||
public static String secretkey;
|
||||
public static String command;
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Parameters
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
@ -51,7 +50,6 @@ public class SignRequest {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (url == null) {
|
||||
System.out.println("Please specify url with -u option. Example: -u \"command=listZones&id=1\"");
|
||||
System.exit(1);
|
||||
|
||||
@ -51,7 +51,6 @@ public class SubmitCert {
|
||||
public static final Logger s_logger = Logger
|
||||
.getLogger(SubmitCert.class.getName());
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Parameters
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
@ -112,7 +111,6 @@ public class SubmitCert {
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
TreeMap<String, String> param = new TreeMap<String, String>();
|
||||
|
||||
String req = "GET\n" + host + ":" + prop.getProperty("port") + "\n/" + prop.getProperty("accesspoint") + "\n";
|
||||
|
||||
@ -76,7 +76,8 @@ public class TestClient {
|
||||
|
||||
if (arg.equals("-c")) {
|
||||
cleanUp = Boolean.parseBoolean(iter.next());
|
||||
if (!cleanUp) sleepTime = 0L; // no need to wait if we don't ever cleanup
|
||||
if (!cleanUp)
|
||||
sleepTime = 0L; // no need to wait if we don't ever cleanup
|
||||
}
|
||||
|
||||
if (arg.equals("-r")) {
|
||||
@ -94,7 +95,8 @@ public class TestClient {
|
||||
|
||||
final String server = host + ":" + port + testUrl;
|
||||
s_logger.info("Starting test against server: " + server + " with " + numThreads + " thread(s)");
|
||||
if (cleanUp) s_logger.info("Clean up is enabled, each test will wait " + sleepTime + " ms before cleaning up");
|
||||
if (cleanUp)
|
||||
s_logger.info("Clean up is enabled, each test will wait " + sleepTime + " ms before cleaning up");
|
||||
|
||||
if (numOfUsers > 0) {
|
||||
s_logger.info("Pre-generating users for test of size : " + numOfUsers);
|
||||
@ -184,7 +186,8 @@ public class TestClient {
|
||||
if (success) {
|
||||
s_logger.info("***** Completed test for user : " + username + " in " + ((System.currentTimeMillis() - now) / 1000L) + " seconds");
|
||||
} else {
|
||||
s_logger.info("##### FAILED test for user : " + username + " in " + ((System.currentTimeMillis() - now) / 1000L) + " seconds with reason : " + reason);
|
||||
s_logger.info("##### FAILED test for user : " + username + " in " + ((System.currentTimeMillis() - now) / 1000L) + " seconds with reason : " +
|
||||
reason);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Error in thread", e);
|
||||
|
||||
@ -67,7 +67,6 @@ public class UtilsForTest {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, String> parseXML(InputStream is,
|
||||
String[] tagNames) {
|
||||
Map<String, String> returnValues = new HashMap<String, String>();
|
||||
@ -95,7 +94,6 @@ public class UtilsForTest {
|
||||
return returnValues;
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<HashMap<String, String>> parseMulXML(InputStream is, String[] tagNames) {
|
||||
ArrayList<HashMap<String, String>> returnValues = new ArrayList<HashMap<String, String>>();
|
||||
|
||||
@ -131,7 +129,6 @@ public class UtilsForTest {
|
||||
return returnValues;
|
||||
}
|
||||
|
||||
|
||||
public static String createMD5String(String password) {
|
||||
MessageDigest md5;
|
||||
try {
|
||||
@ -154,12 +151,6 @@ public class UtilsForTest {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static Map<String, String> getSingleValueFromXML(InputStream is,
|
||||
String[] tagNames) {
|
||||
Map<String, String> returnValues = new HashMap<String, String>();
|
||||
@ -186,7 +177,6 @@ public class UtilsForTest {
|
||||
return returnValues;
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, List<String>> getMultipleValuesFromXML(
|
||||
InputStream is, String[] tagNames) {
|
||||
Map<String, List<String>> returnValues = new HashMap<String, List<String>>();
|
||||
@ -215,8 +205,6 @@ public class UtilsForTest {
|
||||
return returnValues;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String signRequest(String request, String key) {
|
||||
try {
|
||||
Mac mac = Mac.getInstance("HmacSHA1");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user