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
@ -362,7 +362,7 @@ public interface UserVmService {
|
||||
String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList, Integer cpuSpeed,
|
||||
Integer memory, Integer cpuNumber, Long rootdkisksize)
|
||||
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Starts the virtual machine created from createVirtualMachine.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -482,7 +482,7 @@ public class UserDataType implements org.apache.axis2.databinding.ADBBean {
|
||||
// handle attribute "version"
|
||||
java.lang.String tempAttribVersion =
|
||||
|
||||
reader.getAttributeValue(null, "version");
|
||||
reader.getAttributeValue(null, "version");
|
||||
|
||||
if (tempAttribVersion != null) {
|
||||
java.lang.String content = tempAttribVersion;
|
||||
@ -499,7 +499,7 @@ public class UserDataType implements org.apache.axis2.databinding.ADBBean {
|
||||
// handle attribute "encoding"
|
||||
java.lang.String tempAttribEncoding =
|
||||
|
||||
reader.getAttributeValue(null, "encoding");
|
||||
reader.getAttributeValue(null, "encoding");
|
||||
|
||||
if (tempAttribEncoding != null) {
|
||||
java.lang.String content = tempAttribEncoding;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -57,7 +57,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
getBucketLoggingStatusResponse33 =
|
||||
|
||||
skel.getBucketLoggingStatus(wrappedParam);
|
||||
skel.getBucketLoggingStatus(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), getBucketLoggingStatusResponse33, false);
|
||||
} else
|
||||
@ -70,7 +70,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
copyObjectResponse35 =
|
||||
|
||||
skel.copyObject(wrappedParam);
|
||||
skel.copyObject(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), copyObjectResponse35, false);
|
||||
} else
|
||||
@ -84,7 +84,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
getBucketAccessControlPolicyResponse37 =
|
||||
|
||||
skel.getBucketAccessControlPolicy(wrappedParam);
|
||||
skel.getBucketAccessControlPolicy(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), getBucketAccessControlPolicyResponse37, false);
|
||||
} else
|
||||
@ -97,7 +97,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
listBucketResponse39 =
|
||||
|
||||
skel.listBucket(wrappedParam);
|
||||
skel.listBucket(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), listBucketResponse39, false);
|
||||
} else
|
||||
@ -110,7 +110,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
putObjectResponse41 =
|
||||
|
||||
skel.putObject(wrappedParam);
|
||||
skel.putObject(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), putObjectResponse41, false);
|
||||
} else
|
||||
@ -123,7 +123,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
createBucketResponse43 =
|
||||
|
||||
skel.createBucket(wrappedParam);
|
||||
skel.createBucket(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), createBucketResponse43, false);
|
||||
} else
|
||||
@ -136,7 +136,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
listAllMyBucketsResponse45 =
|
||||
|
||||
skel.listAllMyBuckets(wrappedParam);
|
||||
skel.listAllMyBuckets(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), listAllMyBucketsResponse45, false);
|
||||
} else
|
||||
@ -149,7 +149,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
getObjectResponse47 =
|
||||
|
||||
skel.getObject(wrappedParam);
|
||||
skel.getObject(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), getObjectResponse47, false);
|
||||
} else
|
||||
@ -162,7 +162,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
deleteBucketResponse49 =
|
||||
|
||||
skel.deleteBucket(wrappedParam);
|
||||
skel.deleteBucket(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), deleteBucketResponse49, false);
|
||||
} else
|
||||
@ -175,7 +175,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
setBucketLoggingStatusResponse51 =
|
||||
|
||||
skel.setBucketLoggingStatus(wrappedParam);
|
||||
skel.setBucketLoggingStatus(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), setBucketLoggingStatusResponse51, false);
|
||||
} else
|
||||
@ -189,7 +189,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
getObjectAccessControlPolicyResponse53 =
|
||||
|
||||
skel.getObjectAccessControlPolicy(wrappedParam);
|
||||
skel.getObjectAccessControlPolicy(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), getObjectAccessControlPolicyResponse53, false);
|
||||
} else
|
||||
@ -202,7 +202,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
deleteObjectResponse55 =
|
||||
|
||||
skel.deleteObject(wrappedParam);
|
||||
skel.deleteObject(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), deleteObjectResponse55, false);
|
||||
} else
|
||||
@ -216,7 +216,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
setBucketAccessControlPolicyResponse57 =
|
||||
|
||||
skel.setBucketAccessControlPolicy(wrappedParam);
|
||||
skel.setBucketAccessControlPolicy(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), setBucketAccessControlPolicyResponse57, false);
|
||||
} else
|
||||
@ -230,7 +230,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
setObjectAccessControlPolicyResponse59 =
|
||||
|
||||
skel.setObjectAccessControlPolicy(wrappedParam);
|
||||
skel.setObjectAccessControlPolicy(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), setObjectAccessControlPolicyResponse59, false);
|
||||
} else
|
||||
@ -243,7 +243,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
putObjectInlineResponse61 =
|
||||
|
||||
skel.putObjectInline(wrappedParam);
|
||||
skel.putObjectInline(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), putObjectInlineResponse61, false);
|
||||
} else
|
||||
@ -256,7 +256,7 @@ public class AmazonS3MessageReceiverInOut extends org.apache.axis2.receivers.Abs
|
||||
|
||||
getObjectExtendedResponse63 =
|
||||
|
||||
skel.getObjectExtended(wrappedParam);
|
||||
skel.getObjectExtended(wrappedParam);
|
||||
|
||||
envelope = toEnvelope(getSOAPFactory(msgContext), getObjectExtendedResponse63, false);
|
||||
|
||||
|
||||
@ -333,7 +333,7 @@ public class MetadataDirective implements org.apache.axis2.databinding.ADBBean {
|
||||
public static MetadataDirective fromValue(java.lang.String value) throws java.lang.IllegalArgumentException {
|
||||
MetadataDirective enumeration = (MetadataDirective)
|
||||
|
||||
_table_.get(value);
|
||||
_table_.get(value);
|
||||
|
||||
if (enumeration == null)
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
|
||||
@ -333,7 +333,7 @@ public class MfaDeleteStatus implements org.apache.axis2.databinding.ADBBean {
|
||||
public static MfaDeleteStatus fromValue(java.lang.String value) throws java.lang.IllegalArgumentException {
|
||||
MfaDeleteStatus enumeration = (MfaDeleteStatus)
|
||||
|
||||
_table_.get(value);
|
||||
_table_.get(value);
|
||||
|
||||
if (enumeration == null)
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
|
||||
@ -332,7 +332,7 @@ public class Payer implements org.apache.axis2.databinding.ADBBean {
|
||||
public static Payer fromValue(java.lang.String value) throws java.lang.IllegalArgumentException {
|
||||
Payer enumeration = (Payer)
|
||||
|
||||
_table_.get(value);
|
||||
_table_.get(value);
|
||||
|
||||
if (enumeration == null)
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
|
||||
@ -344,7 +344,7 @@ public class Permission implements org.apache.axis2.databinding.ADBBean {
|
||||
public static Permission fromValue(java.lang.String value) throws java.lang.IllegalArgumentException {
|
||||
Permission enumeration = (Permission)
|
||||
|
||||
_table_.get(value);
|
||||
_table_.get(value);
|
||||
|
||||
if (enumeration == null)
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
|
||||
@ -333,7 +333,7 @@ public class StorageClass implements org.apache.axis2.databinding.ADBBean {
|
||||
public static StorageClass fromValue(java.lang.String value) throws java.lang.IllegalArgumentException {
|
||||
StorageClass enumeration = (StorageClass)
|
||||
|
||||
_table_.get(value);
|
||||
_table_.get(value);
|
||||
|
||||
if (enumeration == null)
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
|
||||
@ -333,7 +333,7 @@ public class VersioningStatus implements org.apache.axis2.databinding.ADBBean {
|
||||
public static VersioningStatus fromValue(java.lang.String value) throws java.lang.IllegalArgumentException {
|
||||
VersioningStatus enumeration = (VersioningStatus)
|
||||
|
||||
_table_.get(value);
|
||||
_table_.get(value);
|
||||
|
||||
if (enumeration == null)
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
|
||||
@ -235,9 +235,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.GetBucketLoggingStatusResponse getBucketLoggingStatus(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.GetBucketLoggingStatus getBucketLoggingStatus0)
|
||||
com.amazon.s3.client.AmazonS3Stub.GetBucketLoggingStatus getBucketLoggingStatus0)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -333,11 +333,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startgetBucketLoggingStatus(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.GetBucketLoggingStatus getBucketLoggingStatus0,
|
||||
com.amazon.s3.client.AmazonS3Stub.GetBucketLoggingStatus getBucketLoggingStatus0,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/GetBucketLoggingStatusRequest");
|
||||
@ -463,9 +463,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.CopyObjectResponse copyObject(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.CopyObject copyObject2)
|
||||
com.amazon.s3.client.AmazonS3Stub.CopyObject copyObject2)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -560,11 +560,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startcopyObject(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.CopyObject copyObject2,
|
||||
com.amazon.s3.client.AmazonS3Stub.CopyObject copyObject2,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/CopyObjectRequest");
|
||||
@ -690,9 +690,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.GetBucketAccessControlPolicyResponse getBucketAccessControlPolicy(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.GetBucketAccessControlPolicy getBucketAccessControlPolicy4)
|
||||
com.amazon.s3.client.AmazonS3Stub.GetBucketAccessControlPolicy getBucketAccessControlPolicy4)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -788,11 +788,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startgetBucketAccessControlPolicy(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.GetBucketAccessControlPolicy getBucketAccessControlPolicy4,
|
||||
com.amazon.s3.client.AmazonS3Stub.GetBucketAccessControlPolicy getBucketAccessControlPolicy4,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[2].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/GetBucketAccessControlPolicyRequest");
|
||||
@ -918,9 +918,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.ListBucketResponse listBucket(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.ListBucket listBucket6)
|
||||
com.amazon.s3.client.AmazonS3Stub.ListBucket listBucket6)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -1015,11 +1015,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startlistBucket(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.ListBucket listBucket6,
|
||||
com.amazon.s3.client.AmazonS3Stub.ListBucket listBucket6,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[3].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/ListBucketRequest");
|
||||
@ -1145,9 +1145,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.PutObjectResponse putObject(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.PutObject putObject8)
|
||||
com.amazon.s3.client.AmazonS3Stub.PutObject putObject8)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -1242,11 +1242,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startputObject(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.PutObject putObject8,
|
||||
com.amazon.s3.client.AmazonS3Stub.PutObject putObject8,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[4].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/PutObjectRequest");
|
||||
@ -1372,9 +1372,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.CreateBucketResponse createBucket(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.CreateBucket createBucket10)
|
||||
com.amazon.s3.client.AmazonS3Stub.CreateBucket createBucket10)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -1470,11 +1470,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startcreateBucket(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.CreateBucket createBucket10,
|
||||
com.amazon.s3.client.AmazonS3Stub.CreateBucket createBucket10,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[5].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/CreateBucketRequest");
|
||||
@ -1600,9 +1600,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.ListAllMyBucketsResponse listAllMyBuckets(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.ListAllMyBuckets listAllMyBuckets12)
|
||||
com.amazon.s3.client.AmazonS3Stub.ListAllMyBuckets listAllMyBuckets12)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -1698,11 +1698,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startlistAllMyBuckets(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.ListAllMyBuckets listAllMyBuckets12,
|
||||
com.amazon.s3.client.AmazonS3Stub.ListAllMyBuckets listAllMyBuckets12,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[6].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/ListAllMyBucketsRequest");
|
||||
@ -1828,9 +1828,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.GetObjectResponse getObject(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObject getObject14)
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObject getObject14)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -1925,11 +1925,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startgetObject(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObject getObject14,
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObject getObject14,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[7].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/GetObjectRequest");
|
||||
@ -2055,9 +2055,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.DeleteBucketResponse deleteBucket(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.DeleteBucket deleteBucket16)
|
||||
com.amazon.s3.client.AmazonS3Stub.DeleteBucket deleteBucket16)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -2153,11 +2153,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startdeleteBucket(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.DeleteBucket deleteBucket16,
|
||||
com.amazon.s3.client.AmazonS3Stub.DeleteBucket deleteBucket16,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[8].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/DeleteBucketRequest");
|
||||
@ -2283,9 +2283,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.SetBucketLoggingStatusResponse setBucketLoggingStatus(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.SetBucketLoggingStatus setBucketLoggingStatus18)
|
||||
com.amazon.s3.client.AmazonS3Stub.SetBucketLoggingStatus setBucketLoggingStatus18)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -2381,11 +2381,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startsetBucketLoggingStatus(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.SetBucketLoggingStatus setBucketLoggingStatus18,
|
||||
com.amazon.s3.client.AmazonS3Stub.SetBucketLoggingStatus setBucketLoggingStatus18,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[9].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/SetBucketLoggingStatusRequest");
|
||||
@ -2511,9 +2511,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.GetObjectAccessControlPolicyResponse getObjectAccessControlPolicy(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObjectAccessControlPolicy getObjectAccessControlPolicy20)
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObjectAccessControlPolicy getObjectAccessControlPolicy20)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -2609,11 +2609,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startgetObjectAccessControlPolicy(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObjectAccessControlPolicy getObjectAccessControlPolicy20,
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObjectAccessControlPolicy getObjectAccessControlPolicy20,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[10].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/GetObjectAccessControlPolicyRequest");
|
||||
@ -2739,9 +2739,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.DeleteObjectResponse deleteObject(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.DeleteObject deleteObject22)
|
||||
com.amazon.s3.client.AmazonS3Stub.DeleteObject deleteObject22)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -2837,11 +2837,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startdeleteObject(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.DeleteObject deleteObject22,
|
||||
com.amazon.s3.client.AmazonS3Stub.DeleteObject deleteObject22,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[11].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/DeleteObjectRequest");
|
||||
@ -2967,9 +2967,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.SetBucketAccessControlPolicyResponse setBucketAccessControlPolicy(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.SetBucketAccessControlPolicy setBucketAccessControlPolicy24)
|
||||
com.amazon.s3.client.AmazonS3Stub.SetBucketAccessControlPolicy setBucketAccessControlPolicy24)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -3065,11 +3065,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startsetBucketAccessControlPolicy(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.SetBucketAccessControlPolicy setBucketAccessControlPolicy24,
|
||||
com.amazon.s3.client.AmazonS3Stub.SetBucketAccessControlPolicy setBucketAccessControlPolicy24,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[12].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/SetBucketAccessControlPolicyRequest");
|
||||
@ -3195,9 +3195,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.SetObjectAccessControlPolicyResponse setObjectAccessControlPolicy(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.SetObjectAccessControlPolicy setObjectAccessControlPolicy26)
|
||||
com.amazon.s3.client.AmazonS3Stub.SetObjectAccessControlPolicy setObjectAccessControlPolicy26)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -3293,11 +3293,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startsetObjectAccessControlPolicy(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.SetObjectAccessControlPolicy setObjectAccessControlPolicy26,
|
||||
com.amazon.s3.client.AmazonS3Stub.SetObjectAccessControlPolicy setObjectAccessControlPolicy26,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[13].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/SetObjectAccessControlPolicyRequest");
|
||||
@ -3423,9 +3423,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.PutObjectInlineResponse putObjectInline(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.PutObjectInline putObjectInline28)
|
||||
com.amazon.s3.client.AmazonS3Stub.PutObjectInline putObjectInline28)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -3521,11 +3521,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startputObjectInline(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.PutObjectInline putObjectInline28,
|
||||
com.amazon.s3.client.AmazonS3Stub.PutObjectInline putObjectInline28,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[14].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/PutObjectInlineRequest");
|
||||
@ -3651,9 +3651,9 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
|
||||
public com.amazon.s3.client.AmazonS3Stub.GetObjectExtendedResponse getObjectExtended(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObjectExtended getObjectExtended30)
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObjectExtended getObjectExtended30)
|
||||
|
||||
throws java.rmi.RemoteException
|
||||
throws java.rmi.RemoteException
|
||||
|
||||
{
|
||||
org.apache.axis2.context.MessageContext _messageContext = null;
|
||||
@ -3749,11 +3749,11 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
*/
|
||||
public void startgetObjectExtended(
|
||||
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObjectExtended getObjectExtended30,
|
||||
com.amazon.s3.client.AmazonS3Stub.GetObjectExtended getObjectExtended30,
|
||||
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
final com.amazon.s3.client.AmazonS3CallbackHandler callback)
|
||||
|
||||
throws java.rmi.RemoteException {
|
||||
throws java.rmi.RemoteException {
|
||||
|
||||
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[15].getName());
|
||||
_operationClient.getOptions().setAction("http://s3.amazonaws.com/doc/2006-03-01/AmazonS3/GetObjectExtendedRequest");
|
||||
@ -18178,7 +18178,7 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
public static Permission fromValue(java.lang.String value) throws java.lang.IllegalArgumentException {
|
||||
Permission enumeration = (Permission)
|
||||
|
||||
_table_.get(value);
|
||||
_table_.get(value);
|
||||
|
||||
if (enumeration == null)
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
@ -22816,7 +22816,7 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
public static MetadataDirective fromValue(java.lang.String value) throws java.lang.IllegalArgumentException {
|
||||
MetadataDirective enumeration = (MetadataDirective)
|
||||
|
||||
_table_.get(value);
|
||||
_table_.get(value);
|
||||
|
||||
if (enumeration == null)
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
@ -28731,7 +28731,7 @@ public class AmazonS3Stub extends org.apache.axis2.client.Stub {
|
||||
public static StorageClass fromValue(java.lang.String value) throws java.lang.IllegalArgumentException {
|
||||
StorageClass enumeration = (StorageClass)
|
||||
|
||||
_table_.get(value);
|
||||
_table_.get(value);
|
||||
|
||||
if (enumeration == null)
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
|
||||
@ -109,7 +109,7 @@ public interface VpcManager {
|
||||
Network createVpcGuestNetwork(long ntwkOffId, String name, String displayText, String gateway, String cidr, String vlanId, String networkDomain, Account owner, Long domainId,
|
||||
PhysicalNetwork pNtwk, long zoneId, ACLType aclType, Boolean subdomainAccess, long vpcId, Long aclId, Account caller, Boolean displayNetworkEnabled)
|
||||
|
||||
throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException;
|
||||
throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Assigns source nat public IP address to VPC
|
||||
|
||||
@ -1252,7 +1252,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
|
||||
profile = new NicProfile(nic, network, broadcastUri, isolationUri,
|
||||
|
||||
networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
|
||||
networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
|
||||
guru.reserve(profile, network, vmProfile, dest, context);
|
||||
nic.setIp4Address(profile.getIp4Address());
|
||||
nic.setAddressFormat(profile.getFormat());
|
||||
|
||||
@ -96,14 +96,14 @@ import java.io.IOException;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackageClasses = {NicDaoImpl.class, VMInstanceDaoImpl.class, VMTemplateHostDaoImpl.class, VolumeHostDaoImpl.class, VolumeDaoImpl.class,
|
||||
VMTemplatePoolDaoImpl.class, ResourceTagsDaoImpl.class, VMTemplateDaoImpl.class, MockStorageMotionStrategy.class, ConfigurationDaoImpl.class,
|
||||
ClusterDaoImpl.class, HostPodDaoImpl.class, VMTemplateZoneDaoImpl.class, VMTemplateDetailsDaoImpl.class, HostDetailsDaoImpl.class, HostTagsDaoImpl.class,
|
||||
HostTransferMapDaoImpl.class, DataCenterIpAddressDaoImpl.class, DataCenterLinkLocalIpAddressDaoImpl.class, DataCenterVnetDaoImpl.class,
|
||||
PodVlanDaoImpl.class, DataCenterDetailsDaoImpl.class, DiskOfferingDaoImpl.class, StoragePoolHostDaoImpl.class, UserVmDaoImpl.class,
|
||||
UserVmDetailsDaoImpl.class, ServiceOfferingDaoImpl.class, CapacityDaoImpl.class, SnapshotDaoImpl.class, VMSnapshotDaoImpl.class, OCFS2ManagerImpl.class,
|
||||
ClusterDetailsDaoImpl.class, SecondaryStorageVmDaoImpl.class, ConsoleProxyDaoImpl.class, StoragePoolWorkDaoImpl.class, StorageCacheManagerImpl.class,
|
||||
UserDaoImpl.class, DataCenterDaoImpl.class, StoragePoolDetailsDaoImpl.class, DomainDaoImpl.class, DownloadMonitorImpl.class, AccountDaoImpl.class,
|
||||
ActionEventUtils.class, EventDaoImpl.class},
|
||||
VMTemplatePoolDaoImpl.class, ResourceTagsDaoImpl.class, VMTemplateDaoImpl.class, MockStorageMotionStrategy.class, ConfigurationDaoImpl.class,
|
||||
ClusterDaoImpl.class, HostPodDaoImpl.class, VMTemplateZoneDaoImpl.class, VMTemplateDetailsDaoImpl.class, HostDetailsDaoImpl.class, HostTagsDaoImpl.class,
|
||||
HostTransferMapDaoImpl.class, DataCenterIpAddressDaoImpl.class, DataCenterLinkLocalIpAddressDaoImpl.class, DataCenterVnetDaoImpl.class,
|
||||
PodVlanDaoImpl.class, DataCenterDetailsDaoImpl.class, DiskOfferingDaoImpl.class, StoragePoolHostDaoImpl.class, UserVmDaoImpl.class,
|
||||
UserVmDetailsDaoImpl.class, ServiceOfferingDaoImpl.class, CapacityDaoImpl.class, SnapshotDaoImpl.class, VMSnapshotDaoImpl.class, OCFS2ManagerImpl.class,
|
||||
ClusterDetailsDaoImpl.class, SecondaryStorageVmDaoImpl.class, ConsoleProxyDaoImpl.class, StoragePoolWorkDaoImpl.class, StorageCacheManagerImpl.class,
|
||||
UserDaoImpl.class, DataCenterDaoImpl.class, StoragePoolDetailsDaoImpl.class, DomainDaoImpl.class, DownloadMonitorImpl.class, AccountDaoImpl.class,
|
||||
ActionEventUtils.class, EventDaoImpl.class},
|
||||
includeFilters = {@Filter(value = Library.class, type = FilterType.CUSTOM)},
|
||||
useDefaultFilters = false)
|
||||
public class ChildTestConfiguration extends TestConfiguration {
|
||||
|
||||
@ -1205,7 +1205,7 @@ public class TransactionLegacy {
|
||||
final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://localhost:3306/" + database, "cloud", "cloud");
|
||||
final PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true);
|
||||
return new PoolingDataSource(
|
||||
/* connectionPool */poolableConnectionFactory.getPool());
|
||||
/* connectionPool */poolableConnectionFactory.getPool());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1265,7 +1265,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Run domr script " + cmd);
|
||||
Pair<Boolean, String> result2 = SshHelper.sshExecute(routerIp, DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), null,
|
||||
// TODO need to find the dev index inside router based on IP address
|
||||
// TODO need to find the dev index inside router based on IP address
|
||||
cmd);
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("result: " + result2.first() + ", output: " + result2.second());
|
||||
|
||||
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,
|
||||
|
||||
@ -61,9 +61,9 @@ public class IdentityDaoImpl extends GenericDaoBase<IdentityVO, Long> implements
|
||||
|
||||
pstmt = txn.prepareAutoCloseStatement(String.format("SELECT id FROM `%s` WHERE id=? OR uuid=?", tableName)
|
||||
|
||||
// TODO : after graceful period, use following line turn on more secure check
|
||||
// String.format("SELECT id FROM %s WHERE (id=? AND uuid IS NULL) OR uuid=?", mapper.entityTableName())
|
||||
);
|
||||
// TODO : after graceful period, use following line turn on more secure check
|
||||
// String.format("SELECT id FROM %s WHERE (id=? AND uuid IS NULL) OR uuid=?", mapper.entityTableName())
|
||||
);
|
||||
|
||||
long id = 0;
|
||||
try {
|
||||
@ -150,8 +150,8 @@ public class IdentityDaoImpl extends GenericDaoBase<IdentityVO, Long> implements
|
||||
try {
|
||||
try {
|
||||
pstmt = txn.prepareAutoCloseStatement(String.format("SELECT uuid FROM `%s` WHERE id=? OR uuid=?", tableName)
|
||||
// String.format("SELECT uuid FROM %s WHERE (id=? AND uuid IS NULL) OR uuid=?", tableName)
|
||||
);
|
||||
// String.format("SELECT uuid FROM %s WHERE (id=? AND uuid IS NULL) OR uuid=?", tableName)
|
||||
);
|
||||
|
||||
long id = 0;
|
||||
try {
|
||||
|
||||
@ -42,7 +42,7 @@ import com.cloud.vm.dao.VMInstanceDaoImpl;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackageClasses = {SnapshotDaoImpl.class, ResourceTagsDaoImpl.class, VMInstanceDaoImpl.class, VolumeDaoImpl.class, NicDaoImpl.class, HostDaoImpl.class,
|
||||
HostDetailsDaoImpl.class, HostTagsDaoImpl.class, HostTransferMapDaoImpl.class, ClusterDaoImpl.class, HostPodDaoImpl.class},
|
||||
HostDetailsDaoImpl.class, HostTagsDaoImpl.class, HostTransferMapDaoImpl.class, ClusterDaoImpl.class, HostPodDaoImpl.class},
|
||||
includeFilters = {@Filter(value = SnapshotDaoTestConfiguration.Library.class, type = FilterType.CUSTOM)},
|
||||
useDefaultFilters = false)
|
||||
public class SnapshotDaoTestConfiguration {
|
||||
|
||||
@ -109,20 +109,20 @@ import com.cloud.vpc.dao.MockVpcOfferingServiceMapDaoImpl;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackageClasses = {VpcManagerImpl.class, NetworkElement.class, VpcOfferingDao.class, ConfigurationDaoImpl.class, IPAddressDaoImpl.class,
|
||||
DomainRouterDaoImpl.class, VpcGatewayDaoImpl.class, PrivateIpDaoImpl.class, StaticRouteDaoImpl.class, PhysicalNetworkDaoImpl.class,
|
||||
ResourceTagsDaoImpl.class, FirewallRulesDaoImpl.class, VlanDaoImpl.class, AccountDaoImpl.class, ResourceCountDaoImpl.class,
|
||||
Site2SiteVpnGatewayDaoImpl.class, PodVlanMapDaoImpl.class, AccountVlanMapDaoImpl.class, HostDaoImpl.class, HostDetailsDaoImpl.class, HostTagsDaoImpl.class,
|
||||
HostTransferMapDaoImpl.class, ClusterDaoImpl.class, HostPodDaoImpl.class, RouterNetworkDaoImpl.class, UserStatisticsDaoImpl.class,
|
||||
PhysicalNetworkTrafficTypeDaoImpl.class, FirewallRulesCidrsDaoImpl.class, ResourceLimitManagerImpl.class, ResourceLimitDaoImpl.class,
|
||||
ResourceCountDaoImpl.class, DomainDaoImpl.class, UserVmDaoImpl.class, UserVmDetailsDaoImpl.class, NicDaoImpl.class, SnapshotDaoImpl.class,
|
||||
VMInstanceDaoImpl.class, VolumeDaoImpl.class, UserIpv6AddressDaoImpl.class, NicSecondaryIpDaoImpl.class, VpcServiceMapDaoImpl.class,
|
||||
ServiceOfferingDaoImpl.class, VMTemplateHostDaoImpl.class, MockVpcDaoImpl.class, VMTemplateDaoImpl.class, VMTemplateZoneDaoImpl.class,
|
||||
VMTemplateDetailsDaoImpl.class, DataCenterDaoImpl.class, DataCenterIpAddressDaoImpl.class, DataCenterLinkLocalIpAddressDaoImpl.class,
|
||||
DataCenterVnetDaoImpl.class, PodVlanDaoImpl.class, DataCenterDetailsDaoImpl.class, MockNetworkManagerImpl.class,
|
||||
MockVpcVirtualNetworkApplianceManager.class, EntityManagerImpl.class, LoadBalancerDaoImpl.class, FirewallRulesCidrsDaoImpl.class,
|
||||
VirtualRouterProviderDaoImpl.class, ProjectDaoImpl.class, ProjectAccountDaoImpl.class, MockVpcOfferingDaoImpl.class, MockConfigurationManagerImpl.class,
|
||||
MockNetworkOfferingServiceMapDaoImpl.class, MockNetworkServiceMapDaoImpl.class, MockVpcOfferingServiceMapDaoImpl.class, MockNetworkOfferingDaoImpl.class,
|
||||
MockNetworkModelImpl.class, Ipv6AddressManagerImpl.class},
|
||||
DomainRouterDaoImpl.class, VpcGatewayDaoImpl.class, PrivateIpDaoImpl.class, StaticRouteDaoImpl.class, PhysicalNetworkDaoImpl.class,
|
||||
ResourceTagsDaoImpl.class, FirewallRulesDaoImpl.class, VlanDaoImpl.class, AccountDaoImpl.class, ResourceCountDaoImpl.class,
|
||||
Site2SiteVpnGatewayDaoImpl.class, PodVlanMapDaoImpl.class, AccountVlanMapDaoImpl.class, HostDaoImpl.class, HostDetailsDaoImpl.class, HostTagsDaoImpl.class,
|
||||
HostTransferMapDaoImpl.class, ClusterDaoImpl.class, HostPodDaoImpl.class, RouterNetworkDaoImpl.class, UserStatisticsDaoImpl.class,
|
||||
PhysicalNetworkTrafficTypeDaoImpl.class, FirewallRulesCidrsDaoImpl.class, ResourceLimitManagerImpl.class, ResourceLimitDaoImpl.class,
|
||||
ResourceCountDaoImpl.class, DomainDaoImpl.class, UserVmDaoImpl.class, UserVmDetailsDaoImpl.class, NicDaoImpl.class, SnapshotDaoImpl.class,
|
||||
VMInstanceDaoImpl.class, VolumeDaoImpl.class, UserIpv6AddressDaoImpl.class, NicSecondaryIpDaoImpl.class, VpcServiceMapDaoImpl.class,
|
||||
ServiceOfferingDaoImpl.class, VMTemplateHostDaoImpl.class, MockVpcDaoImpl.class, VMTemplateDaoImpl.class, VMTemplateZoneDaoImpl.class,
|
||||
VMTemplateDetailsDaoImpl.class, DataCenterDaoImpl.class, DataCenterIpAddressDaoImpl.class, DataCenterLinkLocalIpAddressDaoImpl.class,
|
||||
DataCenterVnetDaoImpl.class, PodVlanDaoImpl.class, DataCenterDetailsDaoImpl.class, MockNetworkManagerImpl.class,
|
||||
MockVpcVirtualNetworkApplianceManager.class, EntityManagerImpl.class, LoadBalancerDaoImpl.class, FirewallRulesCidrsDaoImpl.class,
|
||||
VirtualRouterProviderDaoImpl.class, ProjectDaoImpl.class, ProjectAccountDaoImpl.class, MockVpcOfferingDaoImpl.class, MockConfigurationManagerImpl.class,
|
||||
MockNetworkOfferingServiceMapDaoImpl.class, MockNetworkServiceMapDaoImpl.class, MockVpcOfferingServiceMapDaoImpl.class, MockNetworkOfferingDaoImpl.class,
|
||||
MockNetworkModelImpl.class, Ipv6AddressManagerImpl.class},
|
||||
includeFilters = {@Filter(value = VpcTestConfiguration.VpcLibrary.class, type = FilterType.CUSTOM)},
|
||||
useDefaultFilters = false)
|
||||
public class VpcTestConfiguration {
|
||||
|
||||
@ -129,15 +129,15 @@ import com.cloud.vm.dao.VMInstanceDaoImpl;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackageClasses = {AccountVlanMapDaoImpl.class, VolumeDaoImpl.class, HostPodDaoImpl.class, DomainDaoImpl.class, ServiceOfferingDaoImpl.class,
|
||||
ServiceOfferingDetailsDaoImpl.class, VlanDaoImpl.class, IPAddressDaoImpl.class, ResourceTagsDaoImpl.class, AccountDaoImpl.class, InstanceGroupDaoImpl.class,
|
||||
UserAccountJoinDaoImpl.class, CapacityDaoImpl.class, SnapshotDaoImpl.class, HostDaoImpl.class, VMInstanceDaoImpl.class, HostTransferMapDaoImpl.class,
|
||||
PortForwardingRulesDaoImpl.class, PrivateIpDaoImpl.class, UsageEventDaoImpl.class, PodVlanMapDaoImpl.class, DiskOfferingDaoImpl.class,
|
||||
DataCenterDaoImpl.class, DataCenterIpAddressDaoImpl.class, DataCenterVnetDaoImpl.class, PodVlanDaoImpl.class, DataCenterDetailsDaoImpl.class,
|
||||
NicSecondaryIpDaoImpl.class, UserIpv6AddressDaoImpl.class, UserDaoImpl.class, NicDaoImpl.class, NetworkDomainDaoImpl.class, HostDetailsDaoImpl.class,
|
||||
HostTagsDaoImpl.class, ClusterDaoImpl.class, FirewallRulesDaoImpl.class, FirewallRulesCidrsDaoImpl.class, PhysicalNetworkDaoImpl.class,
|
||||
PhysicalNetworkTrafficTypeDaoImpl.class, PhysicalNetworkServiceProviderDaoImpl.class, LoadBalancerDaoImpl.class, NetworkServiceMapDaoImpl.class,
|
||||
PrimaryDataStoreDaoImpl.class, StoragePoolDetailsDaoImpl.class, PortableIpRangeDaoImpl.class, RegionDaoImpl.class, PortableIpDaoImpl.class,
|
||||
AccountGuestVlanMapDaoImpl.class},
|
||||
ServiceOfferingDetailsDaoImpl.class, VlanDaoImpl.class, IPAddressDaoImpl.class, ResourceTagsDaoImpl.class, AccountDaoImpl.class, InstanceGroupDaoImpl.class,
|
||||
UserAccountJoinDaoImpl.class, CapacityDaoImpl.class, SnapshotDaoImpl.class, HostDaoImpl.class, VMInstanceDaoImpl.class, HostTransferMapDaoImpl.class,
|
||||
PortForwardingRulesDaoImpl.class, PrivateIpDaoImpl.class, UsageEventDaoImpl.class, PodVlanMapDaoImpl.class, DiskOfferingDaoImpl.class,
|
||||
DataCenterDaoImpl.class, DataCenterIpAddressDaoImpl.class, DataCenterVnetDaoImpl.class, PodVlanDaoImpl.class, DataCenterDetailsDaoImpl.class,
|
||||
NicSecondaryIpDaoImpl.class, UserIpv6AddressDaoImpl.class, UserDaoImpl.class, NicDaoImpl.class, NetworkDomainDaoImpl.class, HostDetailsDaoImpl.class,
|
||||
HostTagsDaoImpl.class, ClusterDaoImpl.class, FirewallRulesDaoImpl.class, FirewallRulesCidrsDaoImpl.class, PhysicalNetworkDaoImpl.class,
|
||||
PhysicalNetworkTrafficTypeDaoImpl.class, PhysicalNetworkServiceProviderDaoImpl.class, LoadBalancerDaoImpl.class, NetworkServiceMapDaoImpl.class,
|
||||
PrimaryDataStoreDaoImpl.class, StoragePoolDetailsDaoImpl.class, PortableIpRangeDaoImpl.class, RegionDaoImpl.class, PortableIpDaoImpl.class,
|
||||
AccountGuestVlanMapDaoImpl.class},
|
||||
includeFilters = {@Filter(value = ChildTestConfiguration.Library.class, type = FilterType.CUSTOM)},
|
||||
useDefaultFilters = false)
|
||||
public class ChildTestConfiguration {
|
||||
|
||||
@ -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,108 +21,103 @@ 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());
|
||||
private static final int _apiPort=8096;
|
||||
private static final int _developerPort=8080;
|
||||
public static final Logger s_logger = Logger.getLogger(BuildGuestNetwork.class.getClass());
|
||||
private static final int _apiPort = 8096;
|
||||
private static final int _developerPort = 8080;
|
||||
private static final String _apiUrl = "/client/api";
|
||||
private static int numVM=1;
|
||||
private static long zoneId=-1L;
|
||||
private static long templateId=3;
|
||||
private static long serviceOfferingId=1;
|
||||
private static int numVM = 1;
|
||||
private static long zoneId = -1L;
|
||||
private static long templateId = 3;
|
||||
private static long serviceOfferingId = 1;
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
Iterator<String> iter = argsList.iterator();
|
||||
String host = "http://localhost";
|
||||
int numThreads = 1;
|
||||
|
||||
public static void main (String[] args){
|
||||
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
Iterator<String> iter = argsList.iterator();
|
||||
String host = "http://localhost";
|
||||
int numThreads = 1;
|
||||
|
||||
while (iter.hasNext()){
|
||||
String arg = iter.next();
|
||||
if (arg.equals("-h")){
|
||||
host="http://"+iter.next();
|
||||
}
|
||||
if (arg.equals("-t")){
|
||||
numThreads=Integer.parseInt(iter.next());
|
||||
}
|
||||
if (arg.equals("-n")){
|
||||
numVM=Integer.parseInt(iter.next());
|
||||
}
|
||||
if (arg.equals("-z")){
|
||||
zoneId=Integer.parseInt(iter.next());
|
||||
}
|
||||
|
||||
if (arg.equals("-e")){
|
||||
templateId=Integer.parseInt(iter.next());
|
||||
}
|
||||
|
||||
if (arg.equals("-s")){
|
||||
serviceOfferingId=Integer.parseInt(iter.next());
|
||||
}
|
||||
while (iter.hasNext()) {
|
||||
String arg = iter.next();
|
||||
if (arg.equals("-h")) {
|
||||
host = "http://" + iter.next();
|
||||
}
|
||||
if (arg.equals("-t")) {
|
||||
numThreads = Integer.parseInt(iter.next());
|
||||
}
|
||||
if (arg.equals("-n")) {
|
||||
numVM = Integer.parseInt(iter.next());
|
||||
}
|
||||
if (arg.equals("-z")) {
|
||||
zoneId = Integer.parseInt(iter.next());
|
||||
}
|
||||
|
||||
final String server = host + ":" + _apiPort + "/";
|
||||
final String developerServer = host + ":" + _developerPort + _apiUrl;
|
||||
s_logger.info("Starting test in "+numThreads+" thread(s). Each thread is launching "+numVM+" VMs");
|
||||
if (arg.equals("-e")) {
|
||||
templateId = Integer.parseInt(iter.next());
|
||||
}
|
||||
|
||||
for (int i=0; i<numThreads; i++){
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try{
|
||||
if (arg.equals("-s")) {
|
||||
serviceOfferingId = Integer.parseInt(iter.next());
|
||||
}
|
||||
}
|
||||
|
||||
final String server = host + ":" + _apiPort + "/";
|
||||
final String developerServer = host + ":" + _developerPort + _apiUrl;
|
||||
s_logger.info("Starting test in " + numThreads + " thread(s). Each thread is launching " + numVM + " VMs");
|
||||
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
String username = null;
|
||||
String singlePrivateIp=null;
|
||||
String singlePrivateIp = null;
|
||||
Random ran = new Random();
|
||||
username = Math.abs(ran.nextInt())+ "-user";
|
||||
username = Math.abs(ran.nextInt()) + "-user";
|
||||
|
||||
//Create User
|
||||
User myUser = new User(username,username, server, developerServer);
|
||||
try{
|
||||
User myUser = new User(username, username, server, developerServer);
|
||||
try {
|
||||
myUser.launchUser();
|
||||
myUser.registerUser();
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Error code: ", e);
|
||||
}
|
||||
|
||||
if (myUser.getUserId()!=null){
|
||||
s_logger.info("User "+myUser.getUserName()+" was created successfully, starting VM creation");
|
||||
if (myUser.getUserId() != null) {
|
||||
s_logger.info("User " + myUser.getUserName() + " was created successfully, starting VM creation");
|
||||
//create VMs for the user
|
||||
for (int i=0; i<numVM; i++){
|
||||
for (int i = 0; i < numVM; i++) {
|
||||
//Create a new VM, add it to the list of user's VMs
|
||||
VirtualMachine myVM = new VirtualMachine(myUser.getUserId());
|
||||
myVM.deployVM(zoneId, serviceOfferingId, templateId, myUser.getDeveloperServer(), myUser.getApiKey(), myUser.getSecretKey());
|
||||
myUser.getVirtualMachines().add(myVM);
|
||||
singlePrivateIp=myVM.getPrivateIp();
|
||||
singlePrivateIp = myVM.getPrivateIp();
|
||||
|
||||
if (singlePrivateIp!=null){
|
||||
s_logger.info("VM with private Ip "+singlePrivateIp+" was successfully created");
|
||||
if (singlePrivateIp != null) {
|
||||
s_logger.info("VM with private Ip " + singlePrivateIp + " was successfully created");
|
||||
}
|
||||
else{
|
||||
s_logger.info("Problems with VM creation for a user"+myUser.getUserName());
|
||||
else {
|
||||
s_logger.info("Problems with VM creation for a user" + myUser.getUserName());
|
||||
s_logger.info("Deployment failed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
s_logger.info("Deployment done..."+numVM+" VMs were created.");
|
||||
s_logger.info("Deployment done..." + numVM + " VMs were created.");
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
s_logger.error(e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
s_logger.error(e);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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,119 +32,114 @@ 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());
|
||||
private static final int _retry=10;
|
||||
private static final int _apiPort=8096;
|
||||
private static int numVM=2;
|
||||
private static final long _zoneId=-1L;
|
||||
private static final long _templateId=3;
|
||||
private static final long _serviceOfferingId=1;
|
||||
private static final String _apiUrl = "/client/api";
|
||||
private static final int _developerPort=8080;
|
||||
public static final Logger s_logger = Logger.getLogger(PerformanceWithAPI.class.getClass());
|
||||
private static final int _retry = 10;
|
||||
private static final int _apiPort = 8096;
|
||||
private static int numVM = 2;
|
||||
private static final long _zoneId = -1L;
|
||||
private static final long _templateId = 3;
|
||||
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){
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
Iterator<String> iter = argsList.iterator();
|
||||
String host = "http://localhost";
|
||||
int numThreads = 1;
|
||||
|
||||
while (iter.hasNext()){
|
||||
while (iter.hasNext()) {
|
||||
String arg = iter.next();
|
||||
if (arg.equals("-h")){
|
||||
host="http://"+iter.next();
|
||||
if (arg.equals("-h")) {
|
||||
host = "http://" + iter.next();
|
||||
}
|
||||
if (arg.equals("-t")){
|
||||
numThreads=Integer.parseInt(iter.next());
|
||||
if (arg.equals("-t")) {
|
||||
numThreads = Integer.parseInt(iter.next());
|
||||
}
|
||||
if (arg.equals("-n")){
|
||||
numVM=Integer.parseInt(iter.next());
|
||||
if (arg.equals("-n")) {
|
||||
numVM = Integer.parseInt(iter.next());
|
||||
}
|
||||
}
|
||||
|
||||
final String server = host + ":" + _apiPort + "/";
|
||||
final String developerServer = host + ":" + _developerPort + _apiUrl;
|
||||
|
||||
s_logger.info("Starting test in "+numThreads+" thread(s). Each thread is launching "+numVM+" VMs");
|
||||
s_logger.info("Starting test in " + numThreads + " thread(s). Each thread is launching " + numVM + " VMs");
|
||||
|
||||
for (int i=0; i<numThreads; i++){
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try{
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
String username = null;
|
||||
String singlePrivateIp=null;
|
||||
String singlePublicIp=null;
|
||||
Random ran = new Random();
|
||||
username = Math.abs(ran.nextInt())+ "-user";
|
||||
String username = null;
|
||||
String singlePrivateIp = null;
|
||||
String singlePublicIp = null;
|
||||
Random ran = new Random();
|
||||
username = Math.abs(ran.nextInt()) + "-user";
|
||||
|
||||
//Create User
|
||||
User myUser = new User(username,username, server, developerServer);
|
||||
try{
|
||||
myUser.launchUser();
|
||||
myUser.registerUser();
|
||||
}catch (Exception e){
|
||||
s_logger.warn("Error code: ", e);
|
||||
}
|
||||
|
||||
if (myUser.getUserId()!=null){
|
||||
s_logger.info("User "+myUser.getUserName()+" was created successfully, starting VM creation");
|
||||
//create VMs for the user
|
||||
for (int i=0; i<numVM; i++){
|
||||
//Create a new VM, add it to the list of user's VMs
|
||||
VirtualMachine myVM = new VirtualMachine(myUser.getUserId());
|
||||
myVM.deployVM(_zoneId, _serviceOfferingId, _templateId, myUser.getDeveloperServer(), myUser.getApiKey(), myUser.getSecretKey());
|
||||
myUser.getVirtualMachines().add(myVM);
|
||||
singlePrivateIp=myVM.getPrivateIp();
|
||||
|
||||
if (singlePrivateIp!=null){
|
||||
s_logger.info("VM with private Ip "+singlePrivateIp+" was successfully created");
|
||||
}
|
||||
else{
|
||||
s_logger.info("Problems with VM creation for a user"+myUser.getUserName());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//get public IP address for the User
|
||||
myUser.retrievePublicIp(_zoneId);
|
||||
singlePublicIp=myUser.getPublicIp().get(myUser.getPublicIp().size()-1);
|
||||
if (singlePublicIp!=null){
|
||||
s_logger.info("Successfully got public Ip "+singlePublicIp+" for user "+myUser.getUserName());
|
||||
}
|
||||
else{
|
||||
s_logger.info("Problems with getting public Ip address for user"+myUser.getUserName());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//create ForwardProxy rules for user's VMs
|
||||
int responseCode = CreateForwardingRule(myUser, singlePrivateIp, singlePublicIp, "22", "22");
|
||||
if (responseCode==500)
|
||||
break;
|
||||
//Create User
|
||||
User myUser = new User(username, username, server, developerServer);
|
||||
try {
|
||||
myUser.launchUser();
|
||||
myUser.registerUser();
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Error code: ", e);
|
||||
}
|
||||
|
||||
s_logger.info("Deployment successful..."+numVM+" VMs were created. Waiting for 5 min before performance test");
|
||||
Thread.sleep(300000L); // Wait
|
||||
if (myUser.getUserId() != null) {
|
||||
s_logger.info("User " + myUser.getUserName() + " was created successfully, starting VM creation");
|
||||
//create VMs for the user
|
||||
for (int i = 0; i < numVM; i++) {
|
||||
//Create a new VM, add it to the list of user's VMs
|
||||
VirtualMachine myVM = new VirtualMachine(myUser.getUserId());
|
||||
myVM.deployVM(_zoneId, _serviceOfferingId, _templateId, myUser.getDeveloperServer(), myUser.getApiKey(), myUser.getSecretKey());
|
||||
myUser.getVirtualMachines().add(myVM);
|
||||
singlePrivateIp = myVM.getPrivateIp();
|
||||
|
||||
if (singlePrivateIp != null) {
|
||||
s_logger.info("VM with private Ip " + singlePrivateIp + " was successfully created");
|
||||
}
|
||||
else {
|
||||
s_logger.info("Problems with VM creation for a user" + myUser.getUserName());
|
||||
break;
|
||||
}
|
||||
|
||||
//get public IP address for the User
|
||||
myUser.retrievePublicIp(_zoneId);
|
||||
singlePublicIp = myUser.getPublicIp().get(myUser.getPublicIp().size() - 1);
|
||||
if (singlePublicIp != null) {
|
||||
s_logger.info("Successfully got public Ip " + singlePublicIp + " for user " + myUser.getUserName());
|
||||
}
|
||||
else {
|
||||
s_logger.info("Problems with getting public Ip address for user" + myUser.getUserName());
|
||||
break;
|
||||
}
|
||||
|
||||
//create ForwardProxy rules for user's VMs
|
||||
int responseCode = CreateForwardingRule(myUser, singlePrivateIp, singlePublicIp, "22", "22");
|
||||
if (responseCode == 500)
|
||||
break;
|
||||
}
|
||||
|
||||
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());
|
||||
guestNetwork myNetwork = new guestNetwork(myUser.getPublicIp().get(j), _retry);
|
||||
myNetwork.setVirtualMachines(myUser.getVirtualMachines());
|
||||
new Thread(myNetwork).start();
|
||||
}
|
||||
|
||||
//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());
|
||||
guestNetwork myNetwork =new guestNetwork(myUser.getPublicIp().get(j), _retry);
|
||||
myNetwork.setVirtualMachines(myUser.getVirtualMachines());
|
||||
new Thread(myNetwork).start();
|
||||
}
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
s_logger.error(e);
|
||||
}
|
||||
}
|
||||
@ -154,56 +148,54 @@ private static final int _developerPort=8080;
|
||||
}
|
||||
}
|
||||
|
||||
private static int CreateForwardingRule(User myUser, String privateIp, String publicIp, String publicPort, String privatePort) throws IOException{
|
||||
String encodedPrivateIp=URLEncoder.encode(""+privateIp, "UTF-8");
|
||||
String encodedPublicIp=URLEncoder.encode(""+publicIp, "UTF-8");
|
||||
String encodedPrivatePort=URLEncoder.encode(""+privatePort, "UTF-8");
|
||||
String encodedPublicPort=URLEncoder.encode(""+publicPort, "UTF-8");
|
||||
private static int CreateForwardingRule(User myUser, String privateIp, String publicIp, String publicPort, String privatePort) throws IOException {
|
||||
String encodedPrivateIp = URLEncoder.encode("" + privateIp, "UTF-8");
|
||||
String encodedPublicIp = URLEncoder.encode("" + publicIp, "UTF-8");
|
||||
String encodedPrivatePort = URLEncoder.encode("" + privatePort, "UTF-8");
|
||||
String encodedPublicPort = URLEncoder.encode("" + publicPort, "UTF-8");
|
||||
String encodedApiKey = URLEncoder.encode(myUser.getApiKey(), "UTF-8");
|
||||
int responseCode=500;
|
||||
|
||||
int responseCode = 500;
|
||||
|
||||
String requestToSign = "apiKey=" + encodedApiKey
|
||||
+ "&command=createOrUpdateIpForwardingRule&privateIp="
|
||||
+ encodedPrivateIp + "&privatePort=" + encodedPrivatePort
|
||||
+ "&protocol=tcp&publicIp="
|
||||
+ encodedPublicIp + "&publicPort="+encodedPublicPort;
|
||||
+ "&command=createOrUpdateIpForwardingRule&privateIp="
|
||||
+ encodedPrivateIp + "&privatePort=" + encodedPrivatePort
|
||||
+ "&protocol=tcp&publicIp="
|
||||
+ encodedPublicIp + "&publicPort=" + encodedPublicPort;
|
||||
|
||||
requestToSign = requestToSign.toLowerCase();
|
||||
s_logger.info("Request to sign is "+requestToSign);
|
||||
s_logger.info("Request to sign is " + requestToSign);
|
||||
|
||||
String signature = TestClientWithAPI.signRequest(requestToSign, myUser.getSecretKey());
|
||||
String encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
|
||||
String url = myUser.getDeveloperServer() + "?command=createOrUpdateIpForwardingRule"
|
||||
+ "&publicIp=" + encodedPublicIp
|
||||
+ "&publicPort="+encodedPublicPort+"&privateIp=" + encodedPrivateIp
|
||||
+ "&privatePort=" + encodedPrivatePort + "&protocol=tcp&apiKey=" + encodedApiKey
|
||||
+ "&signature=" + encodedSignature;
|
||||
+ "&publicIp=" + encodedPublicIp
|
||||
+ "&publicPort=" + encodedPublicPort + "&privateIp=" + encodedPrivateIp
|
||||
+ "&privatePort=" + encodedPrivatePort + "&protocol=tcp&apiKey=" + encodedApiKey
|
||||
+ "&signature=" + encodedSignature;
|
||||
|
||||
s_logger.info("Trying to create IP forwarding rule: "+url);
|
||||
s_logger.info("Trying to create IP forwarding rule: " + url);
|
||||
HttpClient client = new HttpClient();
|
||||
HttpMethod method = new GetMethod(url);
|
||||
responseCode = client.executeMethod(method);
|
||||
s_logger.info("create ip forwarding rule response code: "
|
||||
+ responseCode);
|
||||
+ responseCode);
|
||||
if (responseCode == 200) {
|
||||
s_logger.info("The rule is created successfully");
|
||||
} else if (responseCode == 500) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> errorInfo = TestClientWithAPI.getSingleValueFromXML(is,
|
||||
new String[] { "errorCode", "description" });
|
||||
new String[] {"errorCode", "description"});
|
||||
s_logger
|
||||
.error("create ip forwarding rule (linux) test failed with errorCode: "
|
||||
+ errorInfo.get("errorCode")
|
||||
+ " and description: "
|
||||
+ errorInfo.get("description"));
|
||||
.error("create ip forwarding rule (linux) test failed with errorCode: "
|
||||
+ errorInfo.get("errorCode")
|
||||
+ " and description: "
|
||||
+ errorInfo.get("description"));
|
||||
} else {
|
||||
s_logger.error("internal error processing request: "
|
||||
+ method.getStatusText());
|
||||
+ method.getStatusText());
|
||||
}
|
||||
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,10 +30,8 @@ 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());
|
||||
public static final Logger s_logger = Logger.getLogger(User.class.getClass());
|
||||
|
||||
private ArrayList<VirtualMachine> virtualMachines;
|
||||
private ArrayList<String> publicIp;
|
||||
@ -45,13 +44,12 @@ public class User {
|
||||
private String password;
|
||||
private String encryptedPassword;
|
||||
|
||||
|
||||
public User(String userName, String password, String server, String developerServer)
|
||||
{
|
||||
this.server=server;
|
||||
this.developerServer=developerServer;
|
||||
this.userName=userName;
|
||||
this.password=password;
|
||||
this.server = server;
|
||||
this.developerServer = developerServer;
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
this.virtualMachines = new ArrayList<VirtualMachine>();
|
||||
this.publicIp = new ArrayList<String>();
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -146,12 +128,12 @@ public class User {
|
||||
|
||||
public void launchUser() throws IOException {
|
||||
String encodedUsername = URLEncoder.encode(this.getUserName(), "UTF-8");
|
||||
this.encryptedPassword=TestClientWithAPI.createMD5Password(this.getPassword());
|
||||
this.encryptedPassword = TestClientWithAPI.createMD5Password(this.getPassword());
|
||||
String encodedPassword = URLEncoder.encode(this.encryptedPassword, "UTF-8");
|
||||
String url = this.server + "?command=createUser&username=" + encodedUsername
|
||||
+ "&password=" + encodedPassword
|
||||
+ "&firstname=Test&lastname=Test&email=alena@vmops.com&domainId=1";
|
||||
String userIdStr=null;
|
||||
+ "&password=" + encodedPassword
|
||||
+ "&firstname=Test&lastname=Test&email=alena@vmops.com&domainId=1";
|
||||
String userIdStr = null;
|
||||
HttpClient client = new HttpClient();
|
||||
HttpMethod method = new GetMethod(url);
|
||||
int responseCode = client.executeMethod(method);
|
||||
@ -159,80 +141,78 @@ public class User {
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> userIdValues = TestClientWithAPI.getSingleValueFromXML(is,
|
||||
new String[] { "id" });
|
||||
new String[] {"id"});
|
||||
userIdStr = userIdValues.get("id");
|
||||
if ((userIdStr != null) && (Long.parseLong(userIdStr)!=-1)) {
|
||||
if ((userIdStr != null) && (Long.parseLong(userIdStr) != -1)) {
|
||||
this.setUserId(userIdStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void retrievePublicIp(long zoneId) throws IOException{
|
||||
public void retrievePublicIp(long zoneId) throws IOException {
|
||||
|
||||
String encodedApiKey = URLEncoder.encode(this.apiKey, "UTF-8");
|
||||
String encodedZoneId=URLEncoder.encode(""+zoneId,"UTF-8");
|
||||
String encodedZoneId = URLEncoder.encode("" + zoneId, "UTF-8");
|
||||
String requestToSign = "apiKey=" + encodedApiKey
|
||||
+ "&command=associateIpAddress" + "&zoneId="+encodedZoneId;
|
||||
+ "&command=associateIpAddress" + "&zoneId=" + encodedZoneId;
|
||||
requestToSign = requestToSign.toLowerCase();
|
||||
String signature = TestClientWithAPI.signRequest(requestToSign, this.secretKey);
|
||||
String encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
|
||||
String url = this.developerServer + "?command=associateIpAddress" + "&apiKey="
|
||||
+ encodedApiKey + "&zoneId="+encodedZoneId+"&signature="
|
||||
+ encodedSignature;
|
||||
+ encodedApiKey + "&zoneId=" + encodedZoneId + "&signature="
|
||||
+ encodedSignature;
|
||||
|
||||
HttpClient client = new HttpClient();
|
||||
HttpMethod method = new GetMethod(url);
|
||||
int responseCode=client.executeMethod(method);
|
||||
int responseCode = client.executeMethod(method);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> values = TestClientWithAPI.getSingleValueFromXML(is,
|
||||
new String[] { "ipaddress" });
|
||||
new String[] {"ipaddress"});
|
||||
this.getPublicIp().add(values.get("ipaddress"));
|
||||
s_logger.info("Ip address is " + values.get("ipaddress"));
|
||||
} else if (responseCode == 500) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> errorInfo = TestClientWithAPI.getSingleValueFromXML(is,
|
||||
new String[] { "errorcode", "description" });
|
||||
new String[] {"errorcode", "description"});
|
||||
s_logger.error("associate ip test failed with errorCode: "
|
||||
+ errorInfo.get("errorCode") + " and description: "
|
||||
+ errorInfo.get("description"));
|
||||
+ errorInfo.get("errorCode") + " and description: "
|
||||
+ errorInfo.get("description"));
|
||||
} else {
|
||||
s_logger.error("internal error processing request: "
|
||||
+ method.getStatusText());
|
||||
+ method.getStatusText());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void registerUser()throws HttpException, IOException{
|
||||
public void registerUser() throws HttpException, IOException {
|
||||
|
||||
String encodedUsername = URLEncoder.encode(this.userName, "UTF-8");
|
||||
String encodedPassword = URLEncoder.encode(this.password, "UTF-8");
|
||||
String url = server + "?command=register&username=" + encodedUsername
|
||||
+ "&domainid=1";
|
||||
s_logger.info("registering: " + this.userName+" with url "+url);
|
||||
HttpClient client = new HttpClient();
|
||||
HttpMethod method = new GetMethod(url);
|
||||
int responseCode = client.executeMethod(method);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> requestKeyValues = TestClientWithAPI.getSingleValueFromXML(is,
|
||||
new String[] { "apikey", "secretkey" });
|
||||
this.setApiKey(requestKeyValues.get("apikey"));
|
||||
this.setSecretKey(requestKeyValues.get("secretkey"));
|
||||
} else if (responseCode == 500) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> errorInfo = TestClientWithAPI.getSingleValueFromXML(is,
|
||||
new String[] { "errorcode", "description" });
|
||||
s_logger.error("registration failed with errorCode: "
|
||||
+ errorInfo.get("errorCode") + " and description: "
|
||||
+ errorInfo.get("description"));
|
||||
} else {
|
||||
s_logger.error("internal error processing request: "
|
||||
+ method.getStatusText());
|
||||
}
|
||||
String encodedUsername = URLEncoder.encode(this.userName, "UTF-8");
|
||||
String encodedPassword = URLEncoder.encode(this.password, "UTF-8");
|
||||
String url = server + "?command=register&username=" + encodedUsername
|
||||
+ "&domainid=1";
|
||||
s_logger.info("registering: " + this.userName + " with url " + url);
|
||||
HttpClient client = new HttpClient();
|
||||
HttpMethod method = new GetMethod(url);
|
||||
int responseCode = client.executeMethod(method);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> requestKeyValues = TestClientWithAPI.getSingleValueFromXML(is,
|
||||
new String[] {"apikey", "secretkey"});
|
||||
this.setApiKey(requestKeyValues.get("apikey"));
|
||||
this.setSecretKey(requestKeyValues.get("secretkey"));
|
||||
} else if (responseCode == 500) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> errorInfo = TestClientWithAPI.getSingleValueFromXML(is,
|
||||
new String[] {"errorcode", "description"});
|
||||
s_logger.error("registration failed with errorCode: "
|
||||
+ errorInfo.get("errorCode") + " and description: "
|
||||
+ errorInfo.get("description"));
|
||||
} else {
|
||||
s_logger.error("internal error processing request: "
|
||||
+ method.getStatusText());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -27,65 +27,57 @@ 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());
|
||||
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 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{
|
||||
public void deployVM(long zoneId, long serviceOfferingId, long templateId, String server, String apiKey, String secretKey) throws IOException {
|
||||
|
||||
String encodedZoneId = URLEncoder.encode("" + zoneId, "UTF-8");
|
||||
String encodedServiceOfferingId = URLEncoder.encode(""
|
||||
+ serviceOfferingId, "UTF-8");
|
||||
+ serviceOfferingId, "UTF-8");
|
||||
String encodedTemplateId = URLEncoder.encode("" + templateId,
|
||||
"UTF-8");
|
||||
String encodedApiKey=URLEncoder.encode(apiKey, "UTF-8");
|
||||
"UTF-8");
|
||||
String encodedApiKey = URLEncoder.encode(apiKey, "UTF-8");
|
||||
String requestToSign = "apiKey=" + encodedApiKey
|
||||
+ "&command=deployVirtualMachine&serviceOfferingId="
|
||||
+ encodedServiceOfferingId + "&templateId="
|
||||
+ encodedTemplateId + "&zoneId=" + encodedZoneId;
|
||||
+ "&command=deployVirtualMachine&serviceOfferingId="
|
||||
+ encodedServiceOfferingId + "&templateId="
|
||||
+ encodedTemplateId + "&zoneId=" + encodedZoneId;
|
||||
|
||||
requestToSign = requestToSign.toLowerCase();
|
||||
String signature = TestClientWithAPI.signRequest(requestToSign, secretKey);
|
||||
String encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
String url = server + "?command=deployVirtualMachine"
|
||||
+ "&zoneId=" + encodedZoneId + "&serviceOfferingId="
|
||||
+ encodedServiceOfferingId + "&templateId="
|
||||
+ encodedTemplateId + "&apiKey=" + encodedApiKey
|
||||
+ "&signature=" + encodedSignature;
|
||||
+ "&zoneId=" + encodedZoneId + "&serviceOfferingId="
|
||||
+ encodedServiceOfferingId + "&templateId="
|
||||
+ encodedTemplateId + "&apiKey=" + encodedApiKey
|
||||
+ "&signature=" + encodedSignature;
|
||||
|
||||
s_logger.info("Sending this request to deploy a VM: "+url);
|
||||
s_logger.info("Sending this request to deploy a VM: " + url);
|
||||
HttpClient client = new HttpClient();
|
||||
HttpMethod method = new GetMethod(url);
|
||||
int responseCode = client.executeMethod(method);
|
||||
@ -93,7 +85,7 @@ public class VirtualMachine {
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> values = TestClientWithAPI.getSingleValueFromXML(is,
|
||||
new String[] { "id", "ipaddress" });
|
||||
new String[] {"id", "ipaddress"});
|
||||
long linuxVMId = Long.parseLong(values.get("id"));
|
||||
s_logger.info("got linux virtual machine id: " + linuxVMId);
|
||||
this.setPrivateIp(values.get("ipaddress"));
|
||||
@ -101,16 +93,14 @@ public class VirtualMachine {
|
||||
} else if (responseCode == 500) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> errorInfo = TestClientWithAPI.getSingleValueFromXML(is,
|
||||
new String[] { "errorcode", "description" });
|
||||
new String[] {"errorcode", "description"});
|
||||
s_logger.error("deploy linux vm test failed with errorCode: "
|
||||
+ errorInfo.get("errorCode") + " and description: "
|
||||
+ errorInfo.get("description"));
|
||||
+ errorInfo.get("errorCode") + " and description: "
|
||||
+ errorInfo.get("description"));
|
||||
} else {
|
||||
s_logger.error("internal error processing request: "
|
||||
+ method.getStatusText());
|
||||
+ method.getStatusText());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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,17 +23,16 @@ 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());
|
||||
public class guestNetwork implements Runnable {
|
||||
public static final Logger s_logger = Logger.getLogger(guestNetwork.class.getClass());
|
||||
|
||||
private String publicIp;
|
||||
private ArrayList<VirtualMachine> virtualMachines;
|
||||
private int retryNum;
|
||||
|
||||
public guestNetwork(String publicIp, int retryNum){
|
||||
this.publicIp=publicIp;
|
||||
this.retryNum=retryNum;
|
||||
public guestNetwork(String publicIp, int retryNum) {
|
||||
this.publicIp = publicIp;
|
||||
this.retryNum = retryNum;
|
||||
}
|
||||
|
||||
public ArrayList<VirtualMachine> getVirtualMachines() {
|
||||
@ -43,65 +43,65 @@ public class guestNetwork implements Runnable{
|
||||
this.virtualMachines = virtualMachines;
|
||||
}
|
||||
|
||||
public void run(){
|
||||
NDC.push("Following thread has started"+Thread.currentThread().getName());
|
||||
public void run() {
|
||||
NDC.push("Following thread has started" + Thread.currentThread().getName());
|
||||
int retry = 0;
|
||||
|
||||
//Start copying files between machines in the network
|
||||
s_logger.info("The size of the array is " + this.virtualMachines.size());
|
||||
while (true) {
|
||||
try {
|
||||
if (retry > 0) {
|
||||
s_logger.info("Retry attempt : " + retry
|
||||
+ " ...sleeping 120 seconds before next attempt");
|
||||
Thread.sleep(120000);
|
||||
//Start copying files between machines in the network
|
||||
s_logger.info("The size of the array is " + this.virtualMachines.size());
|
||||
while (true) {
|
||||
try {
|
||||
if (retry > 0) {
|
||||
s_logger.info("Retry attempt : " + retry
|
||||
+ " ...sleeping 120 seconds before next attempt");
|
||||
Thread.sleep(120000);
|
||||
}
|
||||
for (VirtualMachine vm : this.virtualMachines) {
|
||||
|
||||
s_logger.info("Attempting to SSH into linux host " + this.publicIp
|
||||
+ " with retry attempt: " + retry);
|
||||
Connection conn = new Connection(this.publicIp);
|
||||
conn.connect(null, 600000, 600000);
|
||||
|
||||
s_logger.info("SSHed successfully into linux host " + this.publicIp);
|
||||
|
||||
boolean isAuthenticated = conn.authenticateWithPassword("root",
|
||||
"password");
|
||||
|
||||
if (isAuthenticated == false) {
|
||||
s_logger.info("Authentication failed");
|
||||
}
|
||||
for (VirtualMachine vm: this.virtualMachines ){
|
||||
//execute copy command
|
||||
Session sess = conn.openSession();
|
||||
String fileName;
|
||||
Random ran = new Random();
|
||||
fileName = Math.abs(ran.nextInt()) + "-file";
|
||||
String copyCommand = new String("./scpScript " + vm.getPrivateIp() + " " + fileName);
|
||||
s_logger.info("Executing " + copyCommand);
|
||||
sess.execCommand(copyCommand);
|
||||
Thread.sleep(120000);
|
||||
sess.close();
|
||||
|
||||
s_logger.info("Attempting to SSH into linux host " + this.publicIp
|
||||
+ " with retry attempt: " + retry);
|
||||
Connection conn = new Connection(this.publicIp);
|
||||
conn.connect(null, 600000, 600000);
|
||||
//execute wget command
|
||||
sess = conn.openSession();
|
||||
String downloadCommand = new String("wget http://172.16.0.220/scripts/checkDiskSpace.sh; chmod +x *sh; ./checkDiskSpace.sh; rm -rf checkDiskSpace.sh");
|
||||
s_logger.info("Executing " + downloadCommand);
|
||||
sess.execCommand(downloadCommand);
|
||||
Thread.sleep(120000);
|
||||
sess.close();
|
||||
|
||||
s_logger.info("SSHed successfully into linux host " + this.publicIp);
|
||||
|
||||
boolean isAuthenticated = conn.authenticateWithPassword("root",
|
||||
"password");
|
||||
|
||||
if (isAuthenticated == false) {
|
||||
s_logger.info("Authentication failed");
|
||||
}
|
||||
//execute copy command
|
||||
Session sess = conn.openSession();
|
||||
String fileName;
|
||||
Random ran = new Random();
|
||||
fileName=Math.abs(ran.nextInt())+"-file";
|
||||
String copyCommand = new String ("./scpScript "+vm.getPrivateIp()+" "+fileName);
|
||||
s_logger.info("Executing " + copyCommand);
|
||||
sess.execCommand(copyCommand);
|
||||
Thread.sleep(120000);
|
||||
sess.close();
|
||||
|
||||
//execute wget command
|
||||
sess = conn.openSession();
|
||||
String downloadCommand = new String ("wget http://172.16.0.220/scripts/checkDiskSpace.sh; chmod +x *sh; ./checkDiskSpace.sh; rm -rf checkDiskSpace.sh");
|
||||
s_logger.info("Executing " + downloadCommand);
|
||||
sess.execCommand(downloadCommand);
|
||||
Thread.sleep(120000);
|
||||
sess.close();
|
||||
|
||||
//close the connection
|
||||
conn.close();
|
||||
}
|
||||
}catch (Exception ex) {
|
||||
s_logger.error(ex);
|
||||
retry++;
|
||||
if (retry == retryNum) {
|
||||
s_logger.info("Performance Guest Network test failed with error "
|
||||
+ ex.getMessage()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
//close the connection
|
||||
conn.close();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
s_logger.error(ex);
|
||||
retry++;
|
||||
if (retry == retryNum) {
|
||||
s_logger.info("Performance Guest Network test failed with error "
|
||||
+ ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,9 +109,9 @@ public class ApiCommand {
|
||||
// ================FOLLOWING METHODS USE INPUT XML FILE=======================//
|
||||
public void setCommandName() {
|
||||
NodeList commandName = this.xmlCommand.getElementsByTagName("name");
|
||||
Element commandElmnt = (Element) commandName.item(0);
|
||||
Element commandElmnt = (Element)commandName.item(0);
|
||||
NodeList commandNm = commandElmnt.getChildNodes();
|
||||
this.commandName = (((Node) commandNm.item(0)).getNodeValue());
|
||||
this.commandName = (((Node)commandNm.item(0)).getNodeValue());
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -186,27 +186,27 @@ public class ApiCommand {
|
||||
NodeList parameterLst = this.xmlCommand.getElementsByTagName("parameters");
|
||||
if (parameterLst != null) {
|
||||
for (int j = 0; j < parameterLst.getLength(); j++) {
|
||||
Element parameterElement = (Element) parameterLst.item(j);
|
||||
Element parameterElement = (Element)parameterLst.item(j);
|
||||
NodeList itemLst = parameterElement.getElementsByTagName("item");
|
||||
for (int k = 0; k < itemLst.getLength(); k++) {
|
||||
Node item = itemLst.item(k);
|
||||
if (item.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element itemElement = (Element) item;
|
||||
Element itemElement = (Element)item;
|
||||
NodeList itemName = itemElement.getElementsByTagName("name");
|
||||
Element itemNameElement = (Element) itemName.item(0);
|
||||
Element itemNameElement = (Element)itemName.item(0);
|
||||
|
||||
// get value
|
||||
Element itemValueElement = null;
|
||||
if ((itemElement.getElementsByTagName("value") != null) && (itemElement.getElementsByTagName("value").getLength() != 0)) {
|
||||
NodeList itemValue = itemElement.getElementsByTagName("value");
|
||||
itemValueElement = (Element) itemValue.item(0);
|
||||
itemValueElement = (Element)itemValue.item(0);
|
||||
}
|
||||
|
||||
Element itemParamElement = null;
|
||||
// getparam
|
||||
if ((itemElement.getElementsByTagName("param") != null) && (itemElement.getElementsByTagName("param").getLength() != 0)) {
|
||||
NodeList itemParam = itemElement.getElementsByTagName("param");
|
||||
itemParamElement = (Element) itemParam.item(0);
|
||||
itemParamElement = (Element)itemParam.item(0);
|
||||
}
|
||||
|
||||
if ((itemElement.getAttribute("getparam").equals("true")) && (itemParamElement != null)) {
|
||||
@ -223,7 +223,7 @@ public class ApiCommand {
|
||||
}
|
||||
} else if (itemElement.getAttribute("randomnumber").equals("true")) {
|
||||
Random ran = new Random();
|
||||
Integer randomNumber = (Integer) Math.abs(ran.nextInt(65535));
|
||||
Integer randomNumber = (Integer)Math.abs(ran.nextInt(65535));
|
||||
this.urlParam.put(itemNameElement.getTextContent(), randomNumber.toString());
|
||||
if ((itemElement.getAttribute("setparam").equals("true")) && (itemParamElement != null)) {
|
||||
param.put(itemParamElement.getTextContent(), randomNumber.toString());
|
||||
@ -243,9 +243,9 @@ public class ApiCommand {
|
||||
Set<?> c = this.urlParam.entrySet();
|
||||
Iterator<?> it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
try {
|
||||
temp = temp + " -" + key + " " + value;
|
||||
} catch (Exception ex) {
|
||||
@ -258,9 +258,9 @@ public class ApiCommand {
|
||||
Set<?> c = this.urlParam.entrySet();
|
||||
Iterator<?> it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
try {
|
||||
temp = temp + key + "=" + value;
|
||||
} catch (Exception ex) {
|
||||
@ -276,9 +276,9 @@ public class ApiCommand {
|
||||
Set<?> c = this.urlParam.entrySet();
|
||||
Iterator<?> it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
try {
|
||||
temp = temp + "&" + key + "=" + URLEncoder.encode(value, "UTF-8");
|
||||
} catch (Exception ex) {
|
||||
@ -299,9 +299,9 @@ public class ApiCommand {
|
||||
Set<?> c = this.urlParam.entrySet();
|
||||
Iterator<?> it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
try {
|
||||
temp = temp + key + "=" + URLEncoder.encode(value, "UTF-8") + "&";
|
||||
} catch (Exception ex) {
|
||||
@ -327,13 +327,13 @@ public class ApiCommand {
|
||||
NodeList returnLst = this.xmlCommand.getElementsByTagName("returnvalue");
|
||||
if (returnLst != null) {
|
||||
for (int m = 0; m < returnLst.getLength(); m++) {
|
||||
Element returnElement = (Element) returnLst.item(m);
|
||||
Element returnElement = (Element)returnLst.item(m);
|
||||
if (returnElement.getAttribute("list").equals("true")) {
|
||||
this.list = true;
|
||||
NodeList elementLst = returnElement.getElementsByTagName("element");
|
||||
this.listId = (Element) elementLst.item(0);
|
||||
this.listId = (Element)elementLst.item(0);
|
||||
NodeList elementName = returnElement.getElementsByTagName("name");
|
||||
this.listName = (Element) elementName.item(0);
|
||||
this.listName = (Element)elementName.item(0);
|
||||
}
|
||||
else {
|
||||
this.list = false;
|
||||
@ -344,24 +344,24 @@ public class ApiCommand {
|
||||
for (int n = 0; n < itemLst1.getLength(); n++) {
|
||||
Node item = itemLst1.item(n);
|
||||
if (item.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element itemElement = (Element) item;
|
||||
Element itemElement = (Element)item;
|
||||
// get parameter name
|
||||
NodeList itemName = itemElement.getElementsByTagName("name");
|
||||
Element itemNameElement = (Element) itemName.item(0);
|
||||
Element itemNameElement = (Element)itemName.item(0);
|
||||
|
||||
// Get parameters for future use
|
||||
if (itemElement.getAttribute("setparam").equals("true")) {
|
||||
NodeList itemVariable = itemElement.getElementsByTagName("param");
|
||||
Element itemVariableElement = (Element) itemVariable.item(0);
|
||||
Element itemVariableElement = (Element)itemVariable.item(0);
|
||||
setParam.put(itemVariableElement.getTextContent(), itemNameElement.getTextContent());
|
||||
this.required = true;
|
||||
} else if (itemElement.getAttribute("getparam").equals("true")) {
|
||||
NodeList itemVariable = itemElement.getElementsByTagName("param");
|
||||
Element itemVariableElement = (Element) itemVariable.item(0);
|
||||
Element itemVariableElement = (Element)itemVariable.item(0);
|
||||
this.verifyParam.put(itemNameElement.getTextContent(), param.get(itemVariableElement.getTextContent()));
|
||||
} else if ((itemElement.getElementsByTagName("value") != null) && (itemElement.getElementsByTagName("value").getLength() != 0)) {
|
||||
NodeList itemVariable = itemElement.getElementsByTagName("value");
|
||||
Element itemVariableElement = (Element) itemVariable.item(0);
|
||||
Element itemVariableElement = (Element)itemVariable.item(0);
|
||||
this.verifyParam.put(itemNameElement.getTextContent(), itemVariableElement.getTextContent());
|
||||
} else {
|
||||
this.verifyParam.put(itemNameElement.getTextContent(), "no value");
|
||||
@ -426,7 +426,7 @@ public class ApiCommand {
|
||||
}
|
||||
else {
|
||||
// get async job result
|
||||
Element jobTag = (Element) doc.getDocumentElement().getElementsByTagName("jobid").item(0);
|
||||
Element jobTag = (Element)doc.getDocumentElement().getElementsByTagName("jobid").item(0);
|
||||
String jobId = jobTag.getTextContent();
|
||||
Element responseBodyAsyncEl = queryAsyncJobResult(jobId);
|
||||
if (responseBodyAsyncEl == null) {
|
||||
@ -435,7 +435,7 @@ public class ApiCommand {
|
||||
else {
|
||||
this.responseBody = responseBodyAsyncEl;
|
||||
// get status of the job
|
||||
Element jobStatusTag = (Element) responseBodyAsyncEl.getElementsByTagName("jobstatus").item(0);
|
||||
Element jobStatusTag = (Element)responseBodyAsyncEl.getElementsByTagName("jobstatus").item(0);
|
||||
String jobStatus = jobStatusTag.getTextContent();
|
||||
if (!jobStatus.equals("1")) { // Need to modify with different error codes for jobAsync
|
||||
// results
|
||||
@ -478,9 +478,9 @@ public class ApiCommand {
|
||||
Set<?> set = this.setParam.entrySet();
|
||||
Iterator<?> it = set.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
try {
|
||||
String itemName = null;
|
||||
while (this.result.next()) {
|
||||
@ -503,14 +503,14 @@ public class ApiCommand {
|
||||
Iterator<?> it = set.iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
// set parameters needed for the future use
|
||||
NodeList itemName = this.responseBody.getElementsByTagName(value);
|
||||
if ((itemName != null) && (itemName.getLength() != 0)) {
|
||||
for (int i = 0; i < itemName.getLength(); i++) {
|
||||
Element itemNameElement = (Element) itemName.item(i);
|
||||
Element itemNameElement = (Element)itemName.item(i);
|
||||
if (itemNameElement.getChildNodes().getLength() <= 1) {
|
||||
param.put(key, itemNameElement.getTextContent());
|
||||
break;
|
||||
@ -529,15 +529,15 @@ public class ApiCommand {
|
||||
Node requiredNode = returnLst.item(Integer.parseInt(this.listId.getTextContent()));
|
||||
|
||||
if (requiredNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element fstElmnt = (Element) requiredNode;
|
||||
Element fstElmnt = (Element)requiredNode;
|
||||
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
NodeList itemName = fstElmnt.getElementsByTagName(value);
|
||||
if ((itemName != null) && (itemName.getLength() != 0)) {
|
||||
Element itemNameElement = (Element) itemName.item(0);
|
||||
Element itemNameElement = (Element)itemName.item(0);
|
||||
if (itemNameElement.getChildNodes().getLength() <= 1) {
|
||||
param.put(key, itemNameElement.getTextContent());
|
||||
}
|
||||
@ -565,9 +565,9 @@ public class ApiCommand {
|
||||
Iterator<?> it = set.iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
if (value == null) {
|
||||
s_logger.error("Parameter " + key + " is missing in the list of global parameters");
|
||||
return false;
|
||||
@ -575,12 +575,13 @@ public class ApiCommand {
|
||||
|
||||
NodeList itemName = this.responseBody.getElementsByTagName(key);
|
||||
if ((itemName.getLength() != 0) && (itemName != null)) {
|
||||
Element itemNameElement = (Element) itemName.item(0);
|
||||
Element itemNameElement = (Element)itemName.item(0);
|
||||
if (itemNameElement.hasChildNodes()) {
|
||||
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 {
|
||||
@ -598,21 +599,22 @@ public class ApiCommand {
|
||||
Node requiredNode = returnLst.item(Integer.parseInt(this.listId.getTextContent()));
|
||||
|
||||
if (requiredNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element fstElmnt = (Element) requiredNode;
|
||||
Element fstElmnt = (Element)requiredNode;
|
||||
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
if (value == null) {
|
||||
s_logger.error("Parameter " + key + " is missing in the list of global parameters");
|
||||
return false;
|
||||
}
|
||||
NodeList itemName = fstElmnt.getElementsByTagName(key);
|
||||
if ((itemName.getLength() != 0) && (itemName != null)) {
|
||||
Element itemNameElement = (Element) itemName.item(0);
|
||||
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 {
|
||||
@ -627,9 +629,9 @@ public class ApiCommand {
|
||||
Iterator<?> it = set.iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
if (value == null) {
|
||||
s_logger.error("Parameter " + key + " is missing in the list of global parameters");
|
||||
return false;
|
||||
@ -668,7 +670,7 @@ public class ApiCommand {
|
||||
pro.load(in);
|
||||
Enumeration<?> en = pro.propertyNames();
|
||||
while (en.hasMoreElements()) {
|
||||
key = (String) en.nextElement();
|
||||
key = (String)en.nextElement();
|
||||
expectedEvents.put(key, Integer.parseInt(pro.getProperty(key)));
|
||||
}
|
||||
|
||||
@ -681,7 +683,7 @@ public class ApiCommand {
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
ArrayList<HashMap<String, String>> eventValues = UtilsForTest.parseMulXML(
|
||||
is, new String[] { "event" });
|
||||
is, new String[] {"event"});
|
||||
|
||||
for (int i = 0; i < eventValues.size(); i++) {
|
||||
HashMap<String, String> element = eventValues.get(i);
|
||||
@ -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) {
|
||||
@ -742,7 +745,7 @@ public class ApiCommand {
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
ArrayList<HashMap<String, String>> eventValues = UtilsForTest.parseMulXML(
|
||||
is, new String[] { "event" });
|
||||
is, new String[] {"event"});
|
||||
|
||||
for (int i = 0; i < eventValues.size(); i++) {
|
||||
HashMap<String, String> element = eventValues.get(i);
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -805,7 +809,7 @@ public class ApiCommand {
|
||||
Document doc = builder.parse(is);
|
||||
doc.getDocumentElement().normalize();
|
||||
returnBody = doc.getDocumentElement();
|
||||
Element jobStatusTag = (Element) returnBody.getElementsByTagName("jobstatus").item(0);
|
||||
Element jobStatusTag = (Element)returnBody.getElementsByTagName("jobstatus").item(0);
|
||||
String jobStatus = jobStatusTag.getTextContent();
|
||||
if (jobStatus.equals("0")) {
|
||||
try {
|
||||
@ -832,9 +836,9 @@ public class ApiCommand {
|
||||
private String getElementByName(String elementName) {
|
||||
NodeList commandName = this.xmlCommand.getElementsByTagName(elementName);
|
||||
if (commandName.getLength() != 0) {
|
||||
Element commandElmnt = (Element) commandName.item(0);
|
||||
Element commandElmnt = (Element)commandName.item(0);
|
||||
NodeList commandNm = commandElmnt.getChildNodes();
|
||||
return ((Node) commandNm.item(0)).getNodeValue();
|
||||
return ((Node)commandNm.item(0)).getNodeValue();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
@ -844,9 +848,9 @@ public class ApiCommand {
|
||||
private boolean verifyTagValue(String elementName, String expectedValue) {
|
||||
NodeList tag = this.xmlCommand.getElementsByTagName(elementName);
|
||||
if (tag.getLength() != 0) {
|
||||
Element commandElmnt = (Element) tag.item(0);
|
||||
Element commandElmnt = (Element)tag.item(0);
|
||||
NodeList commandNm = commandElmnt.getChildNodes();
|
||||
if (((Node) commandNm.item(0)).getNodeValue().equals(expectedValue)) {
|
||||
if (((Node)commandNm.item(0)).getNodeValue().equals(expectedValue)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@ -23,34 +23,32 @@ 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;
|
||||
|
||||
public class ConfigTest extends TestCase{
|
||||
public class ConfigTest extends TestCase {
|
||||
public static final Logger s_logger = Logger.getLogger(ConfigTest.class.getName());
|
||||
|
||||
public ConfigTest(){
|
||||
public ConfigTest() {
|
||||
this.setClient();
|
||||
this.setParam(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
public boolean executeTest(){
|
||||
public boolean executeTest() {
|
||||
|
||||
int error=0;
|
||||
int error = 0;
|
||||
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++) {
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element) fstNode;
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
//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"));
|
||||
@ -61,7 +59,7 @@ public class ConfigTest extends TestCase{
|
||||
s_logger.info("SSHed successfully into management server " + this.getParam().get("hostip"));
|
||||
|
||||
boolean isAuthenticated = conn.authenticateWithPassword("root",
|
||||
"password");
|
||||
"password");
|
||||
|
||||
if (isAuthenticated == false) {
|
||||
s_logger.info("Authentication failed for root with password");
|
||||
@ -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,13 +119,14 @@ 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package com.cloud.test.regression;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
@ -27,28 +26,28 @@ import org.w3c.dom.NodeList;
|
||||
|
||||
import com.cloud.test.regression.ApiCommand.ResponseType;
|
||||
|
||||
public class DelegatedAdminTest extends TestCase{
|
||||
public class DelegatedAdminTest extends TestCase {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(DelegatedAdminTest.class.getName());
|
||||
public static final Logger s_logger = Logger.getLogger(DelegatedAdminTest.class.getName());
|
||||
|
||||
public DelegatedAdminTest(){
|
||||
public DelegatedAdminTest() {
|
||||
this.setClient();
|
||||
this.setParam(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
public boolean executeTest(){
|
||||
int error=0;
|
||||
public boolean executeTest() {
|
||||
int error = 0;
|
||||
|
||||
for (Document eachElement: this.getInputFile()) {
|
||||
for (Document eachElement : this.getInputFile()) {
|
||||
|
||||
Element rootElement = eachElement.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++) {
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
boolean verify = false;
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element) fstNode;
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
//new command
|
||||
ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
|
||||
@ -72,23 +71,26 @@ 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){
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
}
|
||||
}
|
||||
@ -100,8 +102,8 @@ public static final Logger s_logger = Logger.getLogger(DelegatedAdminTest.class.
|
||||
}
|
||||
error++;
|
||||
}
|
||||
else if (api.getTestCaseInfo() != null){
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
|
||||
}
|
||||
}
|
||||
@ -113,7 +115,7 @@ public static final Logger s_logger = Logger.getLogger(DelegatedAdminTest.class.
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean denyToExecute () {
|
||||
public boolean denyToExecute() {
|
||||
boolean result = true;
|
||||
Integer level1 = Integer.valueOf(this.getParam().get("domainlevel1"));
|
||||
Integer level2 = Integer.valueOf(this.getParam().get("domainlevel2"));
|
||||
|
||||
@ -27,24 +27,23 @@ import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
public class Deploy extends TestCase{
|
||||
public class Deploy extends TestCase {
|
||||
public static final Logger s_logger = Logger.getLogger(Deploy.class.getName());
|
||||
|
||||
public Deploy(){
|
||||
public Deploy() {
|
||||
this.setClient();
|
||||
this.setParam(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
|
||||
public boolean executeTest() {
|
||||
int error=0;
|
||||
int error = 0;
|
||||
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++) {
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element) fstNode;
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
//new command
|
||||
ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
|
||||
@ -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++;
|
||||
@ -62,14 +60,13 @@ public class Deploy extends TestCase{
|
||||
s_logger.info("The command " + api.getUrl() + " passsed");
|
||||
}
|
||||
}
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
Iterator<String> iter = argsList.iterator();
|
||||
@ -87,7 +84,7 @@ public class Deploy extends TestCase{
|
||||
}
|
||||
}
|
||||
|
||||
Deploy deploy = new Deploy ();
|
||||
Deploy deploy = new Deploy();
|
||||
|
||||
ArrayList<String> inputFile = new ArrayList<String>();
|
||||
inputFile.add(file);
|
||||
@ -111,4 +108,3 @@ public class Deploy extends TestCase{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -28,36 +28,33 @@ import com.cloud.test.regression.ApiCommand.ResponseType;
|
||||
import com.trilead.ssh2.Connection;
|
||||
import com.trilead.ssh2.Session;
|
||||
|
||||
public class EventsApiTest extends TestCase{
|
||||
public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getName());
|
||||
public class EventsApiTest extends TestCase {
|
||||
public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getName());
|
||||
|
||||
|
||||
public EventsApiTest(){
|
||||
public EventsApiTest() {
|
||||
this.setClient();
|
||||
this.setParam(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
public boolean executeTest(){
|
||||
int error=0;
|
||||
public boolean executeTest() {
|
||||
int error = 0;
|
||||
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++) {
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element) fstNode;
|
||||
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
//!!!check if we need to execute mySql command
|
||||
NodeList commandName = fstElmnt.getElementsByTagName("name");
|
||||
Element commandElmnt = (Element) commandName.item(0);
|
||||
Element commandElmnt = (Element)commandName.item(0);
|
||||
NodeList commandNm = commandElmnt.getChildNodes();
|
||||
if (((Node) commandNm.item(0)).getNodeValue().equals("mysqlupdate")) {
|
||||
if (((Node)commandNm.item(0)).getNodeValue().equals("mysqlupdate")) {
|
||||
//establish connection to mysql server and execute an update command
|
||||
NodeList mysqlList = fstElmnt.getElementsByTagName("mysqlcommand");
|
||||
for (int j=0; j<mysqlList.getLength(); j++) {
|
||||
Element itemVariableElement = (Element) mysqlList.item(j);
|
||||
for (int j = 0; j < mysqlList.getLength(); j++) {
|
||||
Element itemVariableElement = (Element)mysqlList.item(j);
|
||||
|
||||
s_logger.info("Executing mysql command " + itemVariableElement.getTextContent());
|
||||
try {
|
||||
@ -70,13 +67,13 @@ public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getNa
|
||||
}
|
||||
}
|
||||
|
||||
else if (((Node) commandNm.item(0)).getNodeValue().equals("agentcommand")) {
|
||||
else if (((Node)commandNm.item(0)).getNodeValue().equals("agentcommand")) {
|
||||
//connect to all the agents and execute agent command
|
||||
NodeList commandList = fstElmnt.getElementsByTagName("commandname");
|
||||
Element commandElement = (Element) commandList.item(0);
|
||||
Element commandElement = (Element)commandList.item(0);
|
||||
NodeList ipList = fstElmnt.getElementsByTagName("ip");
|
||||
for (int j=0; j<ipList.getLength(); j++) {
|
||||
Element itemVariableElement = (Element) ipList.item(j);
|
||||
for (int j = 0; j < ipList.getLength(); j++) {
|
||||
Element itemVariableElement = (Element)ipList.item(j);
|
||||
|
||||
s_logger.info("Attempting to SSH into agent " + itemVariableElement.getTextContent());
|
||||
try {
|
||||
@ -86,7 +83,7 @@ public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getNa
|
||||
s_logger.info("SSHed successfully into agent " + itemVariableElement.getTextContent());
|
||||
|
||||
boolean isAuthenticated = conn.authenticateWithPassword("root",
|
||||
"password");
|
||||
"password");
|
||||
|
||||
if (isAuthenticated == false) {
|
||||
s_logger.info("Authentication failed for root with password");
|
||||
@ -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,10 +132,11 @@ 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){
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed. Command was sent with the url " + api.getUrl());
|
||||
}
|
||||
}
|
||||
@ -152,8 +150,8 @@ public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getNa
|
||||
}
|
||||
error++;
|
||||
}
|
||||
else if (api.getTestCaseInfo() != null){
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed. Command that was supposed to fail, failed. Command was sent with url " + api.getUrl());
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed. Command that was supposed to fail, failed. Command was sent with url " + api.getUrl());
|
||||
|
||||
}
|
||||
}
|
||||
@ -162,17 +160,18 @@ 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
|
||||
return true;
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,24 +23,24 @@ import org.w3c.dom.NodeList;
|
||||
|
||||
import com.cloud.test.regression.ApiCommand.ResponseType;
|
||||
|
||||
public class HA extends TestCase{
|
||||
public class HA extends TestCase {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(HA.class.getName());
|
||||
|
||||
public HA(){
|
||||
public HA() {
|
||||
this.setClient();
|
||||
}
|
||||
|
||||
public boolean executeTest(){
|
||||
int error=0;
|
||||
public boolean executeTest() {
|
||||
int error = 0;
|
||||
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++) {
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element) fstNode;
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
//new command
|
||||
ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
|
||||
@ -49,9 +49,10 @@ public class HA extends TestCase{
|
||||
api.sendCommand(this.getClient(), this.getConn());
|
||||
|
||||
//verify the response parameters
|
||||
if ((api.getResponseCode() !=200 ) && (api.getRequired() == true) )
|
||||
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,27 +25,26 @@ import org.w3c.dom.NodeList;
|
||||
|
||||
import com.cloud.test.regression.ApiCommand.ResponseType;
|
||||
|
||||
|
||||
public class LoadBalancingTest extends TestCase{
|
||||
public class LoadBalancingTest extends TestCase {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(LoadBalancingTest.class.getName());
|
||||
|
||||
public LoadBalancingTest(){
|
||||
public LoadBalancingTest() {
|
||||
this.setClient();
|
||||
this.setParam(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
public boolean executeTest(){
|
||||
public boolean executeTest() {
|
||||
|
||||
int error=0;
|
||||
int error = 0;
|
||||
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++) {
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element) fstNode;
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
//new command
|
||||
ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
|
||||
@ -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,10 +73,11 @@ 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){
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
}
|
||||
}
|
||||
@ -91,8 +91,8 @@ public class LoadBalancingTest extends TestCase{
|
||||
}
|
||||
error++;
|
||||
}
|
||||
else if (api.getTestCaseInfo() != null){
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,6 @@ public class LoadBalancingTest extends TestCase{
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
|
||||
@ -25,25 +25,25 @@ import org.w3c.dom.NodeList;
|
||||
|
||||
import com.cloud.test.regression.ApiCommand.ResponseType;
|
||||
|
||||
public class PortForwardingTest extends TestCase{
|
||||
public class PortForwardingTest extends TestCase {
|
||||
public static final Logger s_logger = Logger.getLogger(PortForwardingTest.class.getName());
|
||||
|
||||
public PortForwardingTest(){
|
||||
public PortForwardingTest() {
|
||||
this.setClient();
|
||||
this.setParam(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
public boolean executeTest(){
|
||||
public boolean executeTest() {
|
||||
|
||||
int error=0;
|
||||
int error = 0;
|
||||
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++) {
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element) fstNode;
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
//new command
|
||||
ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
|
||||
@ -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,10 +72,11 @@ 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){
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
}
|
||||
}
|
||||
@ -89,8 +90,8 @@ public class PortForwardingTest extends TestCase{
|
||||
}
|
||||
error++;
|
||||
}
|
||||
else if (api.getTestCaseInfo() != null){
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
|
||||
}
|
||||
}
|
||||
@ -136,7 +137,6 @@ public class PortForwardingTest extends TestCase{
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
|
||||
@ -21,23 +21,23 @@ import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class SanityTest extends TestCase{
|
||||
public class SanityTest extends TestCase {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(SanityTest.class.getName());
|
||||
|
||||
public SanityTest(){
|
||||
public SanityTest() {
|
||||
this.setClient();
|
||||
}
|
||||
|
||||
public boolean executeTest(){
|
||||
int error=0;
|
||||
public boolean executeTest() {
|
||||
int error = 0;
|
||||
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++) {
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element) fstNode;
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
//new command
|
||||
ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
|
||||
@ -45,9 +45,10 @@ public class SanityTest extends TestCase{
|
||||
api.sendCommand(this.getClient(), null);
|
||||
|
||||
//verify the response parameters
|
||||
if ((api.getResponseCode() !=200 ) && (api.getRequired() == true) )
|
||||
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)
|
||||
|
||||
@ -27,24 +27,24 @@ import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
public class Test extends TestCase{
|
||||
public class Test extends TestCase {
|
||||
public static final Logger s_logger = Logger.getLogger(Test.class.getName());
|
||||
|
||||
public Test(){
|
||||
public Test() {
|
||||
this.setClient();
|
||||
this.setParam(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
public boolean executeTest(){
|
||||
public boolean executeTest() {
|
||||
|
||||
int error=0;
|
||||
int error = 0;
|
||||
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++) {
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element) fstNode;
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
//new command
|
||||
ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
|
||||
@ -56,7 +56,7 @@ public class Test extends TestCase{
|
||||
|
||||
//Try to create portForwarding rule for all available private/public ports
|
||||
ArrayList<String> port = new ArrayList<String>();
|
||||
for (int j=1; j<1000; j++){
|
||||
for (int j = 1; j < 1000; j++) {
|
||||
port.add(Integer.toString(j));
|
||||
}
|
||||
|
||||
@ -64,23 +64,23 @@ 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);
|
||||
if (responseCode != 200 ) {
|
||||
if (responseCode != 200) {
|
||||
error++;
|
||||
s_logger.error("Can't create portForwarding network rule for the public port " + portValue + ". Request was sent with url " + url);
|
||||
}
|
||||
}catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
s_logger.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,16 +32,15 @@ import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
|
||||
public abstract class TestCase{
|
||||
public abstract class TestCase {
|
||||
|
||||
public static Logger s_logger = Logger.getLogger(TestCase.class.getName());
|
||||
private Connection conn;
|
||||
private ArrayList <Document> inputFile = new ArrayList<Document> ();
|
||||
private ArrayList<Document> inputFile = new ArrayList<Document>();
|
||||
private HttpClient client;
|
||||
private String testCaseName;
|
||||
private HashMap<String, String> param = new HashMap<String, String> ();
|
||||
private HashMap<String, String> commands = new HashMap<String, String> ();
|
||||
private HashMap<String, String> param = new HashMap<String, String>();
|
||||
private HashMap<String, String> commands = new HashMap<String, String>();
|
||||
|
||||
public HashMap<String, String> getParam() {
|
||||
return param;
|
||||
@ -51,7 +50,6 @@ public abstract class TestCase{
|
||||
this.param = param;
|
||||
}
|
||||
|
||||
|
||||
public HashMap<String, String> getCommands() {
|
||||
return commands;
|
||||
}
|
||||
@ -70,7 +68,7 @@ public abstract class TestCase{
|
||||
pro.load(in);
|
||||
Enumeration<?> en = pro.propertyNames();
|
||||
while (en.hasMoreElements()) {
|
||||
String key = (String) en.nextElement();
|
||||
String key = (String)en.nextElement();
|
||||
commands.put(key, pro.getProperty(key));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@ -87,18 +85,18 @@ public abstract class TestCase{
|
||||
this.conn = null;
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
this.conn=DriverManager.getConnection("jdbc:mysql://" + param.get("db") + "/cloud", "root", dbPassword);
|
||||
this.conn = DriverManager.getConnection("jdbc:mysql://" + param.get("db") + "/cloud", "root", dbPassword);
|
||||
if (!this.conn.isValid(0)) {
|
||||
s_logger.error("Connection to DB failed to establish");
|
||||
}
|
||||
|
||||
}catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
s_logger.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInputFile (ArrayList<String> fileNameInput) {
|
||||
for (String fileName: fileNameInput) {
|
||||
public void setInputFile(ArrayList<String> fileNameInput) {
|
||||
for (String fileName : fileNameInput) {
|
||||
File file = new File(fileName);
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
Document doc = null;
|
||||
@ -121,7 +119,7 @@ public abstract class TestCase{
|
||||
this.testCaseName = testCaseName;
|
||||
}
|
||||
|
||||
public String getTestCaseName(){
|
||||
public String getTestCaseName() {
|
||||
return this.testCaseName;
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ import org.w3c.dom.NodeList;
|
||||
public class TestCaseEngine {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(TestCaseEngine.class
|
||||
.getName());
|
||||
.getName());
|
||||
public static String fileName = "../metadata/adapter.xml";
|
||||
public static HashMap<String, String> globalParameters = new HashMap<String, String>();
|
||||
protected static HashMap<String, String> _componentMap = new HashMap<String, String>();
|
||||
@ -93,7 +93,7 @@ public class TestCaseEngine {
|
||||
// parse adapter.xml file to get list of tests to execute
|
||||
File file = new File(fileName);
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory
|
||||
.newInstance();
|
||||
.newInstance();
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
Document doc = builder.parse(file);
|
||||
doc.getDocumentElement().normalize();
|
||||
@ -111,7 +111,7 @@ public class TestCaseEngine {
|
||||
for (int i = 0; i < _numThreads; i++) {
|
||||
if (_numThreads > 1) {
|
||||
s_logger.info("STARTING STRESS TEST IN "
|
||||
+ _numThreads + " THREADS");
|
||||
+ _numThreads + " THREADS");
|
||||
} else {
|
||||
s_logger.info("STARTING FUNCTIONAL TEST");
|
||||
}
|
||||
@ -122,7 +122,7 @@ public class TestCaseEngine {
|
||||
try {
|
||||
for (String key : _keys) {
|
||||
Class<?> c = Class.forName(_componentMap.get(key));
|
||||
TestCase component = (TestCase) c.newInstance();
|
||||
TestCase component = (TestCase)c.newInstance();
|
||||
executeTest(key, c, component);
|
||||
}
|
||||
} catch (Exception ex1) {
|
||||
@ -134,14 +134,14 @@ public class TestCaseEngine {
|
||||
}
|
||||
} else {
|
||||
Random ran = new Random();
|
||||
Integer randomNumber = (Integer) Math.abs(ran
|
||||
.nextInt(_keys.size()));
|
||||
Integer randomNumber = (Integer)Math.abs(ran
|
||||
.nextInt(_keys.size()));
|
||||
try {
|
||||
String key = _keys.get(randomNumber);
|
||||
Class<?> c = Class.forName(_componentMap
|
||||
.get(key));
|
||||
TestCase component = (TestCase) c
|
||||
.newInstance();
|
||||
.get(key));
|
||||
TestCase component = (TestCase)c
|
||||
.newInstance();
|
||||
executeTest(key, c, component);
|
||||
} catch (Exception e) {
|
||||
s_logger.error("Error in thread ", e);
|
||||
@ -159,21 +159,21 @@ public class TestCaseEngine {
|
||||
|
||||
public static void setGlobalParams(Element rootElement) {
|
||||
NodeList globalParam = rootElement.getElementsByTagName("globalparam");
|
||||
Element parameter = (Element) globalParam.item(0);
|
||||
Element parameter = (Element)globalParam.item(0);
|
||||
NodeList paramLst = parameter.getElementsByTagName("param");
|
||||
|
||||
for (int i = 0; i < paramLst.getLength(); i++) {
|
||||
Element paramElement = (Element) paramLst.item(i);
|
||||
Element paramElement = (Element)paramLst.item(i);
|
||||
|
||||
if (paramElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element itemElement = (Element) paramElement;
|
||||
Element itemElement = (Element)paramElement;
|
||||
NodeList itemName = itemElement.getElementsByTagName("name");
|
||||
Element itemNameElement = (Element) itemName.item(0);
|
||||
Element itemNameElement = (Element)itemName.item(0);
|
||||
NodeList itemVariable = itemElement
|
||||
.getElementsByTagName("variable");
|
||||
Element itemVariableElement = (Element) itemVariable.item(0);
|
||||
.getElementsByTagName("variable");
|
||||
Element itemVariableElement = (Element)itemVariable.item(0);
|
||||
globalParameters.put(itemVariableElement.getTextContent(),
|
||||
itemNameElement.getTextContent());
|
||||
itemNameElement.getTextContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -181,17 +181,17 @@ public class TestCaseEngine {
|
||||
public static void setComponent(Element rootElement) {
|
||||
NodeList testLst = rootElement.getElementsByTagName("test");
|
||||
for (int j = 0; j < testLst.getLength(); j++) {
|
||||
Element testElement = (Element) testLst.item(j);
|
||||
Element testElement = (Element)testLst.item(j);
|
||||
|
||||
if (testElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element itemElement = (Element) testElement;
|
||||
Element itemElement = (Element)testElement;
|
||||
|
||||
// get test case name
|
||||
NodeList testCaseNameList = itemElement
|
||||
.getElementsByTagName("testname");
|
||||
.getElementsByTagName("testname");
|
||||
if (testCaseNameList != null) {
|
||||
testCaseName = ((Element) testCaseNameList.item(0))
|
||||
.getTextContent();
|
||||
testCaseName = ((Element)testCaseNameList.item(0))
|
||||
.getTextContent();
|
||||
}
|
||||
|
||||
if (isSanity == true && !testCaseName.equals("SANITY TEST"))
|
||||
@ -203,20 +203,20 @@ public class TestCaseEngine {
|
||||
NodeList className = itemElement.getElementsByTagName("class");
|
||||
if ((className.getLength() == 0) || (className == null)) {
|
||||
_componentMap.put(testCaseName,
|
||||
"com.cloud.test.regression.VMApiTest");
|
||||
"com.cloud.test.regression.VMApiTest");
|
||||
} else {
|
||||
String name = ((Element) className.item(0))
|
||||
.getTextContent();
|
||||
String name = ((Element)className.item(0))
|
||||
.getTextContent();
|
||||
_componentMap.put(testCaseName, name);
|
||||
}
|
||||
|
||||
// set input file name
|
||||
NodeList inputFileNameLst = itemElement
|
||||
.getElementsByTagName("filename");
|
||||
.getElementsByTagName("filename");
|
||||
_inputFile.put(testCaseName, new ArrayList<String>());
|
||||
for (int k = 0; k < inputFileNameLst.getLength(); k++) {
|
||||
String inputFileName = ((Element) inputFileNameLst.item(k))
|
||||
.getTextContent();
|
||||
String inputFileName = ((Element)inputFileNameLst.item(k))
|
||||
.getTextContent();
|
||||
_inputFile.get(testCaseName).add(inputFileName);
|
||||
}
|
||||
}
|
||||
@ -237,8 +237,8 @@ public class TestCaseEngine {
|
||||
Set<?> set = _componentMap.entrySet();
|
||||
Iterator<?> it = set.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
|
||||
String key = (String) me.getKey();
|
||||
Map.Entry<?, ?> me = (Map.Entry<?, ?>)it.next();
|
||||
String key = (String)me.getKey();
|
||||
_keys.add(key);
|
||||
}
|
||||
|
||||
|
||||
@ -25,25 +25,23 @@ 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 class VMApiTest extends TestCase{
|
||||
public static final Logger s_logger = Logger.getLogger(VMApiTest.class.getName());
|
||||
|
||||
|
||||
public VMApiTest(){
|
||||
public VMApiTest() {
|
||||
this.setClient();
|
||||
this.setParam(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
public boolean executeTest(){
|
||||
int error=0;
|
||||
public boolean executeTest() {
|
||||
int error = 0;
|
||||
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++) {
|
||||
for (int i = 0; i < commandLst.getLength(); i++) {
|
||||
Node fstNode = commandLst.item(i);
|
||||
Element fstElmnt = (Element) fstNode;
|
||||
Element fstElmnt = (Element)fstNode;
|
||||
|
||||
//new command
|
||||
ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
|
||||
@ -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
|
||||
@ -82,14 +81,14 @@ public static final Logger s_logger = Logger.getLogger(VMApiTest.class.getName()
|
||||
}
|
||||
error++;
|
||||
}
|
||||
else if (api.getTestCaseInfo() != null){
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
else if (api.getTestCaseInfo() != null) {
|
||||
s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
|
||||
|
||||
}
|
||||
}
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
if (error != 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ public class SshTest {
|
||||
public static String password = "password";
|
||||
public static String url = "http://google.com";
|
||||
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
|
||||
// Parameters
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
@ -56,7 +56,7 @@ public class SshTest {
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
if (password == null){
|
||||
if (password == null) {
|
||||
s_logger.info("Did not receive a password back from test, ignoring ssh test");
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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);
|
||||
@ -476,7 +478,7 @@ public class TestClientWithAPI {
|
||||
{
|
||||
ipAddressId = n.getTextContent();
|
||||
}
|
||||
else if("ipaddress".equals(n.getNodeName()))
|
||||
else if ("ipaddress".equals(n.getNodeName()))
|
||||
{
|
||||
ipAddress = n.getTextContent();
|
||||
}
|
||||
@ -504,7 +506,7 @@ public class TestClientWithAPI {
|
||||
int responseCode = client.executeMethod(method);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> requestKeyValues = getSingleValueFromXML(is, new String[] { "apikey", "secretkey" });
|
||||
Map<String, String> requestKeyValues = getSingleValueFromXML(is, new String[] {"apikey", "secretkey"});
|
||||
_apiKey.set(requestKeyValues.get("apikey"));
|
||||
returnValue = requestKeyValues.get("secretkey");
|
||||
} else {
|
||||
@ -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);
|
||||
@ -539,7 +542,7 @@ public class TestClientWithAPI {
|
||||
long accountId = -1;
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> accountValues = getSingleValueFromXML(is, new String[] { "id", "name" });
|
||||
Map<String, String> accountValues = getSingleValueFromXML(is, new String[] {"id", "name"});
|
||||
String accountIdStr = accountValues.get("id");
|
||||
s_logger.info("created account " + username + " with id " + accountIdStr);
|
||||
if (accountIdStr != null) {
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -564,7 +568,7 @@ public class TestClientWithAPI {
|
||||
long userId = -1;
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> userIdValues = getSingleValueFromXML(is, new String[] { "id" });
|
||||
Map<String, String> userIdValues = getSingleValueFromXML(is, new String[] {"id"});
|
||||
String userIdStr = userIdValues.get("id");
|
||||
s_logger.info("listed user " + username + " with id " + userIdStr);
|
||||
if (userIdStr != null) {
|
||||
@ -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,20 +598,22 @@ 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);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> networkValues = getSingleValueFromXML(is, new String[] { "id" });
|
||||
Map<String, String> networkValues = getSingleValueFromXML(is, new String[] {"id"});
|
||||
String networkIdStr = networkValues.get("id");
|
||||
s_logger.info("Created virtual network with name virtualnetwork-" + encodedUsername + " and id " + networkIdStr);
|
||||
if (networkIdStr != null) {
|
||||
_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
|
||||
// ---------------------------------
|
||||
@ -643,21 +649,23 @@ public class TestClientWithAPI {
|
||||
String encodedServiceOfferingId = URLEncoder.encode("" + serviceOfferingId, "UTF-8");
|
||||
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
|
||||
+ "&zoneid=" + encodedZoneId;
|
||||
String encodedNetworkIds = URLEncoder.encode(_networkId.get() + ",206", "UTF-8");
|
||||
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
|
||||
+ "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
|
||||
url = developerServer + "?command=deployVirtualMachine" + "&zoneid=" + encodedZoneId + "&serviceofferingid=" + encodedServiceOfferingId + "&diskofferingid=" +
|
||||
diskOfferingId + "&networkids=" + encodedNetworkIds + "&templateid=" + encodedTemplateId
|
||||
+ "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
|
||||
|
||||
method = new GetMethod(url);
|
||||
responseCode = client.executeMethod(method);
|
||||
if (responseCode == 200) {
|
||||
InputStream input = method.getResponseBodyAsStream();
|
||||
Element el = queryAsyncJobResult(server, input);
|
||||
Map<String, String> values = getSingleValueFromXML(el, new String[] { "id", "ipaddress" });
|
||||
Map<String, String> values = getSingleValueFromXML(el, new String[] {"id", "ipaddress"});
|
||||
|
||||
if ((values.get("ipaddress") == null) || (values.get("id") == null)) {
|
||||
s_logger.info("deploy linux vm response code: 401, the command was sent with url " + url);
|
||||
@ -698,9 +706,9 @@ public class TestClientWithAPI {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
/*Asynchronous Job - Corresponding Changes Made*/
|
||||
Element associpel = queryAsyncJobResult(server, is);
|
||||
Map<String, String> values = getSingleValueFromXML(associpel, new String[] {"id", "ipaddress" });
|
||||
Map<String, String> values = getSingleValueFromXML(associpel, new String[] {"id", "ipaddress"});
|
||||
|
||||
if ((values.get("ipaddress") == null)|| (values.get("id") == null)) {
|
||||
if ((values.get("ipaddress") == null) || (values.get("id") == null)) {
|
||||
s_logger.info("associate ip for Windows response code: 401, the command was sent with url " + url);
|
||||
return 401;
|
||||
}
|
||||
@ -717,7 +725,7 @@ public class TestClientWithAPI {
|
||||
}
|
||||
|
||||
String encodedPublicIpId = URLEncoder.encode(_publicIpId.get(), "UTF-8");
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=listPublicIpAddresses"+"&id="+ encodedPublicIpId;
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=listPublicIpAddresses" + "&id=" + encodedPublicIpId;
|
||||
requestToSign = requestToSign.toLowerCase();
|
||||
signature = signRequest(requestToSign, _secretKey.get());
|
||||
encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
@ -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);
|
||||
@ -844,7 +854,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("List volumes response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] { "id" });
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] {"id"});
|
||||
if (success.get("id") == null) {
|
||||
s_logger.error("Unable to get root volume for linux vm. Followin url was sent: " + url);
|
||||
}
|
||||
@ -881,23 +891,25 @@ public class TestClientWithAPI {
|
||||
String encodedServiceOfferingId = URLEncoder.encode("" + serviceOfferingId, "UTF-8");
|
||||
String encodedTemplateId = URLEncoder.encode("" + templateId, "UTF-8");
|
||||
encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
|
||||
String encodedNetworkIds = URLEncoder.encode(_networkId.get()+",206","UTF-8");
|
||||
String encodedNetworkIds = URLEncoder.encode(_networkId.get() + ",206", "UTF-8");
|
||||
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=deployVirtualMachine&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds + "&serviceofferingid=" + encodedServiceOfferingId + "&templateid=" + encodedTemplateId
|
||||
+ "&zoneid=" + encodedZoneId;
|
||||
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="
|
||||
+ encodedTemplateId + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
|
||||
url = developerServer + "?command=deployVirtualMachine" + "&zoneid=" + encodedZoneId + "&serviceofferingid=" + encodedServiceOfferingId + "&diskofferingid=" +
|
||||
diskOfferingId + "&networkids=" + encodedNetworkIds + "&templateid="
|
||||
+ encodedTemplateId + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
|
||||
|
||||
method = new GetMethod(url);
|
||||
responseCode = client.executeMethod(method);
|
||||
if (responseCode == 200) {
|
||||
InputStream input = method.getResponseBodyAsStream();
|
||||
Element el = queryAsyncJobResult(server, input);
|
||||
Map<String, String> values = getSingleValueFromXML(el, new String[] { "id", "ipaddress" });
|
||||
Map<String, String> values = getSingleValueFromXML(el, new String[] {"id", "ipaddress"});
|
||||
|
||||
if ((values.get("ipaddress") == null) || (values.get("id") == null)) {
|
||||
s_logger.info("deploy windows vm response code: 401, the command was sent with url " + url);
|
||||
@ -921,12 +933,13 @@ public class TestClientWithAPI {
|
||||
|
||||
encodedVmId = URLEncoder.encode(_windowsVmId.get(), "UTF-8");
|
||||
encodedPublicIpId = URLEncoder.encode(_publicIpId.get(), "UTF-8");
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=enableStaticNat"+"&ipaddressid="+ encodedPublicIpId + "&virtualMachineId=" + encodedVmId;
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=enableStaticNat" + "&ipaddressid=" + encodedPublicIpId + "&virtualMachineId=" + encodedVmId;
|
||||
requestToSign = requestToSign.toLowerCase();
|
||||
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);
|
||||
@ -934,14 +947,13 @@ public class TestClientWithAPI {
|
||||
s_logger.info("list ip addresses for user " + userId + " response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] { "success" });
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] {"success"});
|
||||
s_logger.info("Enable Static NAT..success? " + success.get("success"));
|
||||
} else {
|
||||
s_logger.error("Enable Static NAT failed with error code: " + responseCode + ". Following URL was sent: " + url);
|
||||
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);
|
||||
@ -995,7 +1008,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("get user response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> userInfo = getSingleValueFromXML(is, new String[] { "username", "id", "account" });
|
||||
Map<String, String> userInfo = getSingleValueFromXML(is, new String[] {"username", "id", "account"});
|
||||
if (!username.equals(userInfo.get("username"))) {
|
||||
s_logger.error("get user failed to retrieve requested user, aborting cleanup test" + ". Following URL was sent: " + url);
|
||||
return -1;
|
||||
@ -1017,7 +1030,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("update user response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] { "success" });
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] {"success"});
|
||||
s_logger.info("update user..success? " + success.get("success"));
|
||||
} else {
|
||||
s_logger.error("update user failed with error code: " + responseCode + ". Following URL was sent: " + url);
|
||||
@ -1037,7 +1050,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("List volumes response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] { "id" });
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] {"id"});
|
||||
s_logger.info("Got dataDiskVolume with id " + success.get("id"));
|
||||
_dataVolume.set(success.get("id"));
|
||||
} else {
|
||||
@ -1090,7 +1103,7 @@ public class TestClientWithAPI {
|
||||
if (responseCode == 200) {
|
||||
InputStream input = method.getResponseBodyAsStream();
|
||||
Element el = queryAsyncJobResult(server, input);
|
||||
Map<String, String> values = getSingleValueFromXML(el, new String[] { "id" });
|
||||
Map<String, String> values = getSingleValueFromXML(el, new String[] {"id"});
|
||||
|
||||
if (values.get("id") == null) {
|
||||
s_logger.info("create volume response code: 401");
|
||||
@ -1136,7 +1149,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("List volumes response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] { "id" });
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] {"id"});
|
||||
if (success.get("id") == null) {
|
||||
s_logger.error("Unable to get root volume. Followin url was sent: " + url);
|
||||
}
|
||||
@ -1163,7 +1176,7 @@ public class TestClientWithAPI {
|
||||
if (responseCode == 200) {
|
||||
InputStream input = method.getResponseBodyAsStream();
|
||||
Element el = queryAsyncJobResult(server, input);
|
||||
Map<String, String> values = getSingleValueFromXML(el, new String[] { "id" });
|
||||
Map<String, String> values = getSingleValueFromXML(el, new String[] {"id"});
|
||||
|
||||
if (values.get("id") == null) {
|
||||
s_logger.info("create snapshot response code: 401");
|
||||
@ -1241,7 +1254,7 @@ public class TestClientWithAPI {
|
||||
if (responseCode == 200) {
|
||||
InputStream input = method.getResponseBodyAsStream();
|
||||
Element el = queryAsyncJobResult(server, input);
|
||||
Map<String, String> success = getSingleValueFromXML(el, new String[] { "success" });
|
||||
Map<String, String> success = getSingleValueFromXML(el, new String[] {"success"});
|
||||
s_logger.info("Windows VM was rebooted with the status: " + success.get("success"));
|
||||
} else {
|
||||
s_logger.error("Reboot windows VM test failed with error code: " + responseCode + ". Following URL was sent: " + url);
|
||||
@ -1262,7 +1275,7 @@ public class TestClientWithAPI {
|
||||
if (responseCode == 200) {
|
||||
InputStream input = method.getResponseBodyAsStream();
|
||||
Element el = queryAsyncJobResult(server, input);
|
||||
Map<String, String> success = getSingleValueFromXML(el, new String[] { "success" });
|
||||
Map<String, String> success = getSingleValueFromXML(el, new String[] {"success"});
|
||||
s_logger.info("Linux VM was stopped with the status: " + success.get("success"));
|
||||
} else {
|
||||
s_logger.error("Stop linux VM test failed with error code: " + responseCode + ". Following URL was sent: " + 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);
|
||||
@ -1283,7 +1298,7 @@ public class TestClientWithAPI {
|
||||
if (responseCode == 200) {
|
||||
InputStream input = method.getResponseBodyAsStream();
|
||||
Element el = queryAsyncJobResult(server, input);
|
||||
Map<String, String> values = getSingleValueFromXML(el, new String[] { "id" });
|
||||
Map<String, String> values = getSingleValueFromXML(el, new String[] {"id"});
|
||||
|
||||
if (values.get("id") == null) {
|
||||
s_logger.info("create private template response code: 401");
|
||||
@ -1321,7 +1336,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("List domain routers response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] { "id" });
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] {"id"});
|
||||
s_logger.info("Got the domR with id " + success.get("id"));
|
||||
_domainRouterId.set(success.get("id"));
|
||||
} else {
|
||||
@ -1387,7 +1402,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("get events response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, List<String>> eventDescriptions = getMultipleValuesFromXML(is, new String[] { "description" });
|
||||
Map<String, List<String>> eventDescriptions = getMultipleValuesFromXML(is, new String[] {"description"});
|
||||
List<String> descriptionText = eventDescriptions.get("description");
|
||||
if (descriptionText == null) {
|
||||
s_logger.info("no events retrieved...");
|
||||
@ -1417,7 +1432,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("generate usage records response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> successStr = getSingleValueFromXML(is, new String[] { "success" });
|
||||
Map<String, String> successStr = getSingleValueFromXML(is, new String[] {"success"});
|
||||
s_logger.info("successfully generated usage records? " + successStr.get("success"));
|
||||
} else {
|
||||
s_logger.error("generate usage records failed with error code: " + responseCode + ". Following URL was sent: " + url);
|
||||
@ -1442,7 +1457,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("get usage records response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, List<String>> usageRecValues = getMultipleValuesFromXML(is, new String[] { "description", "usage" });
|
||||
Map<String, List<String>> usageRecValues = getMultipleValuesFromXML(is, new String[] {"description", "usage"});
|
||||
if ((usageRecValues.containsKey("description") == true) && (usageRecValues.containsKey("usage") == true)) {
|
||||
List<String> descriptions = usageRecValues.get("description");
|
||||
List<String> usages = usageRecValues.get("usage");
|
||||
@ -1475,14 +1490,15 @@ public class TestClientWithAPI {
|
||||
s_logger.info("listAccountStatistics response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> requestKeyValues = getSingleValueFromXML(is, new String[] { "receivedbytes", "sentbytes" });
|
||||
Map<String, String> requestKeyValues = getSingleValueFromXML(is, new String[] {"receivedbytes", "sentbytes"});
|
||||
int bytesReceived = Integer.parseInt(requestKeyValues.get("receivedbytes"));
|
||||
int bytesSent = Integer.parseInt(requestKeyValues.get("sentbytes"));
|
||||
if ((bytesReceived > 100000000) && (bytesSent > 0)) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1518,7 +1534,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("get user response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> userIdValues = getSingleValueFromXML(is, new String[] { "id" });
|
||||
Map<String, String> userIdValues = getSingleValueFromXML(is, new String[] {"id"});
|
||||
String userIdStr = userIdValues.get("id");
|
||||
if (userIdStr != null) {
|
||||
userId = userIdStr;
|
||||
@ -1552,7 +1568,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("list virtual machines response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, List<String>> vmIdValues = getMultipleValuesFromXML(is, new String[] { "id" });
|
||||
Map<String, List<String>> vmIdValues = getMultipleValuesFromXML(is, new String[] {"id"});
|
||||
if (vmIdValues.containsKey("id")) {
|
||||
List<String> vmIdList = vmIdValues.get("id");
|
||||
if (vmIdList != null) {
|
||||
@ -1591,7 +1607,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("list ip addresses for user " + userId + " response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, List<String>> ipAddressValues = getMultipleValuesFromXML(is, new String[] { "ipaddress" });
|
||||
Map<String, List<String>> ipAddressValues = getMultipleValuesFromXML(is, new String[] {"ipaddress"});
|
||||
if (ipAddressValues.containsKey("ipaddress")) {
|
||||
List<String> ipAddressList = ipAddressValues.get("ipaddress");
|
||||
if (ipAddressList != null) {
|
||||
@ -1630,7 +1646,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("list zones response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, List<String>> zoneNameValues = getMultipleValuesFromXML(is, new String[] { "name" });
|
||||
Map<String, List<String>> zoneNameValues = getMultipleValuesFromXML(is, new String[] {"name"});
|
||||
if (zoneNameValues.containsKey("name")) {
|
||||
List<String> zoneNameList = zoneNameValues.get("name");
|
||||
if (zoneNameList != null) {
|
||||
@ -1671,7 +1687,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("listAccountStatistics response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, List<String>> statValues = getMultipleValuesFromXML(is, new String[] { "receivedbytes" });
|
||||
Map<String, List<String>> statValues = getMultipleValuesFromXML(is, new String[] {"receivedbytes"});
|
||||
if (statValues.containsKey("receivedbytes")) {
|
||||
List<String> statList = statValues.get("receivedbytes");
|
||||
if (statList != null) {
|
||||
@ -1712,7 +1728,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("list templates response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, List<String>> templateNameValues = getMultipleValuesFromXML(is, new String[] { "name" });
|
||||
Map<String, List<String>> templateNameValues = getMultipleValuesFromXML(is, new String[] {"name"});
|
||||
|
||||
if (templateNameValues.containsKey("name")) {
|
||||
List<String> templateNameList = templateNameValues.get("name");
|
||||
@ -1754,7 +1770,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("list service offerings response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, List<String>> serviceOfferingNameValues = getMultipleValuesFromXML(is, new String[] { "name" });
|
||||
Map<String, List<String>> serviceOfferingNameValues = getMultipleValuesFromXML(is, new String[] {"name"});
|
||||
|
||||
if (serviceOfferingNameValues.containsKey("name")) {
|
||||
List<String> serviceOfferingNameList = serviceOfferingNameValues.get("name");
|
||||
@ -1789,7 +1805,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("list events response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, List<String>> eventNameValues = getMultipleValuesFromXML(is, new String[] { "description" });
|
||||
Map<String, List<String>> eventNameValues = getMultipleValuesFromXML(is, new String[] {"description"});
|
||||
|
||||
if (eventNameValues.containsKey("description")) {
|
||||
List<String> eventNameList = eventNameValues.get("description");
|
||||
@ -1831,7 +1847,7 @@ public class TestClientWithAPI {
|
||||
if (responseCode == 200) {
|
||||
InputStream input = method.getResponseBodyAsStream();
|
||||
Element el = queryAsyncJobResult(server, input);
|
||||
Map<String, String> success = getSingleValueFromXML(el, new String[] { "success" });
|
||||
Map<String, String> success = getSingleValueFromXML(el, new String[] {"success"});
|
||||
s_logger.info(cmdName + "..success? " + success.get("success"));
|
||||
} else {
|
||||
s_logger.error(cmdName + "test failed with error code: " + responseCode + ". Following URL was sent: " + url);
|
||||
@ -1907,12 +1923,12 @@ public class TestClientWithAPI {
|
||||
//--------------------------------------------
|
||||
encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
|
||||
String encodedPublicIpId = URLEncoder.encode(_publicIpId.get(), "UTF-8");
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=disableStaticNat"+"&id=" + encodedPublicIpId;
|
||||
requestToSign = "apikey=" + encodedApiKey + "&command=disableStaticNat" + "&id=" + encodedPublicIpId;
|
||||
requestToSign = requestToSign.toLowerCase();
|
||||
signature = signRequest(requestToSign, _secretKey.get());
|
||||
encodedSignature = URLEncoder.encode(signature, "UTF-8");
|
||||
|
||||
url = developerServer + "?command=disableStaticNat&apikey=" + encodedApiKey + "&id=" + encodedPublicIpId + "&signature=" + encodedSignature ;
|
||||
url = developerServer + "?command=disableStaticNat&apikey=" + encodedApiKey + "&id=" + encodedPublicIpId + "&signature=" + encodedSignature;
|
||||
client = new HttpClient();
|
||||
method = new GetMethod(url);
|
||||
responseCode = client.executeMethod(method);
|
||||
@ -1920,7 +1936,7 @@ public class TestClientWithAPI {
|
||||
s_logger.info("list ip addresses for user " + userId + " response code: " + responseCode);
|
||||
if (responseCode == 200) {
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] { "success" });
|
||||
Map<String, String> success = getSingleValueFromXML(is, new String[] {"success"});
|
||||
s_logger.info("Disable Static NAT..success? " + success.get("success"));
|
||||
} else {
|
||||
s_logger.error("Disable Static NAT failed with error code: " + responseCode + ". Following URL was sent: " + url);
|
||||
@ -2219,7 +2235,7 @@ public class TestClientWithAPI {
|
||||
public static Element queryAsyncJobResult(String host, InputStream inputStream) {
|
||||
Element returnBody = null;
|
||||
|
||||
Map<String, String> values = getSingleValueFromXML(inputStream, new String[] { "jobid" });
|
||||
Map<String, String> values = getSingleValueFromXML(inputStream, new String[] {"jobid"});
|
||||
String jobId = values.get("jobid");
|
||||
|
||||
if (jobId == null) {
|
||||
@ -2241,7 +2257,7 @@ public class TestClientWithAPI {
|
||||
Document doc = builder.parse(is);
|
||||
returnBody = doc.getDocumentElement();
|
||||
doc.getDocumentElement().normalize();
|
||||
Element jobStatusTag = (Element) returnBody.getElementsByTagName("jobstatus").item(0);
|
||||
Element jobStatusTag = (Element)returnBody.getElementsByTagName("jobstatus").item(0);
|
||||
String jobStatus = jobStatusTag.getTextContent();
|
||||
if (jobStatus.equals("0")) {
|
||||
try {
|
||||
|
||||
@ -34,9 +34,7 @@ public class WgetTest {
|
||||
public static String host = "";
|
||||
public static String password = "rs-ccb35ea5";
|
||||
|
||||
|
||||
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
|
||||
// Parameters
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
@ -58,104 +56,103 @@ public class WgetTest {
|
||||
int i = 0;
|
||||
if (host == null || host.equals("")) {
|
||||
s_logger
|
||||
.info("Did not receive a host back from test, ignoring ssh test");
|
||||
.info("Did not receive a host back from test, ignoring ssh test");
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
if (password == null){
|
||||
if (password == null) {
|
||||
s_logger.info("Did not receive a password back from test, ignoring ssh test");
|
||||
System.exit(2);
|
||||
}
|
||||
int retry = 0;
|
||||
|
||||
try {
|
||||
if (retry > 0) {
|
||||
s_logger.info("Retry attempt : " + retry
|
||||
+ " ...sleeping 120 seconds before next attempt");
|
||||
Thread.sleep(120000);
|
||||
}
|
||||
try {
|
||||
if (retry > 0) {
|
||||
s_logger.info("Retry attempt : " + retry
|
||||
+ " ...sleeping 120 seconds before next attempt");
|
||||
Thread.sleep(120000);
|
||||
}
|
||||
|
||||
s_logger.info("Attempting to SSH into linux host " + host
|
||||
+ " with retry attempt: " + retry);
|
||||
s_logger.info("Attempting to SSH into linux host " + host
|
||||
+ " with retry attempt: " + retry);
|
||||
|
||||
Connection conn = new Connection(host);
|
||||
conn.connect(null, 60000, 60000);
|
||||
Connection conn = new Connection(host);
|
||||
conn.connect(null, 60000, 60000);
|
||||
|
||||
s_logger.info("User + ssHed successfully into linux host " + host);
|
||||
s_logger.info("User + ssHed successfully into linux host " + host);
|
||||
|
||||
boolean isAuthenticated = conn.authenticateWithPassword("root",
|
||||
password);
|
||||
boolean isAuthenticated = conn.authenticateWithPassword("root",
|
||||
password);
|
||||
|
||||
if (isAuthenticated == false) {
|
||||
s_logger.info("Authentication failed for root with password" + password);
|
||||
System.exit(2);
|
||||
}
|
||||
if (isAuthenticated == false) {
|
||||
s_logger.info("Authentication failed for root with password" + password);
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
boolean success = false;
|
||||
String linuxCommand = null;
|
||||
boolean success = false;
|
||||
String linuxCommand = null;
|
||||
|
||||
if (i % 10 == 0)
|
||||
linuxCommand = "rm -rf *; wget http://192.168.1.250/dump.bin && ls -al dump.bin";
|
||||
else
|
||||
linuxCommand = "wget http://192.168.1.250/dump.bin && ls -al dump.bin";
|
||||
if (i % 10 == 0)
|
||||
linuxCommand = "rm -rf *; wget http://192.168.1.250/dump.bin && ls -al dump.bin";
|
||||
else
|
||||
linuxCommand = "wget http://192.168.1.250/dump.bin && ls -al dump.bin";
|
||||
|
||||
Session sess = conn.openSession();
|
||||
sess.execCommand(linuxCommand);
|
||||
Session sess = conn.openSession();
|
||||
sess.execCommand(linuxCommand);
|
||||
|
||||
InputStream stdout = sess.getStdout();
|
||||
InputStream stderr = sess.getStderr();
|
||||
InputStream stdout = sess.getStdout();
|
||||
InputStream stderr = sess.getStderr();
|
||||
|
||||
byte[] buffer = new byte[8192];
|
||||
while (true) {
|
||||
if ((stdout.available() == 0) && (stderr.available() == 0)) {
|
||||
int conditions = sess.waitForCondition(
|
||||
ChannelCondition.STDOUT_DATA
|
||||
| ChannelCondition.STDERR_DATA
|
||||
| ChannelCondition.EOF, 120000);
|
||||
|
||||
byte[] buffer = new byte[8192];
|
||||
while (true) {
|
||||
if ((stdout.available() == 0) && (stderr.available() == 0)) {
|
||||
int conditions = sess.waitForCondition(
|
||||
ChannelCondition.STDOUT_DATA
|
||||
| ChannelCondition.STDERR_DATA
|
||||
| ChannelCondition.EOF, 120000);
|
||||
|
||||
if ((conditions & ChannelCondition.TIMEOUT) != 0) {
|
||||
s_logger
|
||||
.info("Timeout while waiting for data from peer.");
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
if ((conditions & ChannelCondition.EOF) != 0) {
|
||||
if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (stdout.available() > 0) {
|
||||
success = true;
|
||||
int len = stdout.read(buffer);
|
||||
if (len > 0) // this check is somewhat paranoid
|
||||
s_logger.info(new String(buffer, 0, len));
|
||||
}
|
||||
|
||||
while (stderr.available() > 0) {
|
||||
/* int len = */stderr.read(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
sess.close();
|
||||
conn.close();
|
||||
|
||||
if (!success) {
|
||||
retry++;
|
||||
if (retry == MAX_RETRY_LINUX) {
|
||||
if ((conditions & ChannelCondition.TIMEOUT) != 0) {
|
||||
s_logger
|
||||
.info("Timeout while waiting for data from peer.");
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
if ((conditions & ChannelCondition.EOF) != 0) {
|
||||
if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
while (stdout.available() > 0) {
|
||||
success = true;
|
||||
int len = stdout.read(buffer);
|
||||
if (len > 0) // this check is somewhat paranoid
|
||||
s_logger.info(new String(buffer, 0, len));
|
||||
}
|
||||
|
||||
while (stderr.available() > 0) {
|
||||
/* int len = */stderr.read(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
sess.close();
|
||||
conn.close();
|
||||
|
||||
if (!success) {
|
||||
retry++;
|
||||
s_logger.error("SSH Linux Network test fail with error");
|
||||
if (retry == MAX_RETRY_LINUX) {
|
||||
s_logger.error("Ssh test failed");
|
||||
System.exit(2);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
retry++;
|
||||
s_logger.error("SSH Linux Network test fail with error");
|
||||
if (retry == MAX_RETRY_LINUX) {
|
||||
s_logger.error("Ssh test failed");
|
||||
System.exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ public abstract class AbstractSeleniumTestCase {
|
||||
}
|
||||
|
||||
protected static DefaultSelenium createSeleniumClient(String url)
|
||||
throws Exception {
|
||||
throws Exception {
|
||||
return new DefaultSelenium("localhost", 4444, "*firefox", url);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,45 +43,49 @@ public class AddAndDeleteAISO extends AbstractSeleniumTestCase {
|
||||
String iso_url = System.getProperty("add_iso_url", "http://10.91.28.6/ISO/Fedora-11-i386-DVD.iso");
|
||||
selenium.type("add_iso_url", iso_url);
|
||||
String iso_zone = System.getProperty("add_iso_zone", "All Zones");
|
||||
selenium.select("add_iso_zone", "label="+iso_zone);
|
||||
selenium.select("add_iso_zone", "label=" + iso_zone);
|
||||
String iso_os_type = System.getProperty("add_iso_os_type", "Fedora 11");
|
||||
selenium.select("add_iso_os_type", "label="+iso_os_type);
|
||||
selenium.select("add_iso_os_type", "label=" + iso_os_type);
|
||||
selenium.click("//div[28]/div[11]/button[1]");
|
||||
Thread.sleep(3000);
|
||||
int i=1;
|
||||
int i = 1;
|
||||
try
|
||||
{
|
||||
for(;;i++)
|
||||
for (;; i++)
|
||||
{
|
||||
System.out.println("i= "+i);
|
||||
selenium.click("//div[" +i+ "]/div/div[2]/span/span");
|
||||
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);
|
||||
}
|
||||
|
||||
assertTrue(selenium.isTextPresent("Adding succeeded"));
|
||||
Thread.sleep(3000);
|
||||
int status=1;
|
||||
while(!selenium.isTextPresent("Ready"))
|
||||
int status = 1;
|
||||
while (!selenium.isTextPresent("Ready"))
|
||||
{
|
||||
for(int j =1;j<=i;j++)
|
||||
for (int j = 1; j <= i; j++)
|
||||
|
||||
{
|
||||
if (selenium.isTextPresent("Ready"))
|
||||
{
|
||||
status=0;
|
||||
status = 0;
|
||||
break;
|
||||
}
|
||||
selenium.click("//div["+j+"]/div/div[2]/span/span");
|
||||
selenium.click("//div[" + j + "]/div/div[2]/span/span");
|
||||
}
|
||||
if(status==0){
|
||||
if (status == 0) {
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -42,45 +42,49 @@ public class AddAndDeleteATemplate extends AbstractSeleniumTestCase {
|
||||
String template_url = System.getProperty("add_template_url", "http://10.91.28.6/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2");
|
||||
selenium.type("add_template_url", template_url);
|
||||
String template_zone = System.getProperty("add_template_zone", "All Zones");
|
||||
selenium.select("add_template_zone", "label="+template_zone);
|
||||
selenium.select("add_template_zone", "label=" + template_zone);
|
||||
String template_os_type = System.getProperty("add_template_os_type", "CentOS 5.3 (32-bit)");
|
||||
selenium.select("add_template_os_type", "label="+template_os_type);
|
||||
selenium.select("add_template_os_type", "label=" + template_os_type);
|
||||
selenium.click("//div[28]/div[11]/button[1]");
|
||||
Thread.sleep(3000);
|
||||
int i=1;
|
||||
int i = 1;
|
||||
try
|
||||
{
|
||||
for(;;i++)
|
||||
for (;; i++)
|
||||
{
|
||||
System.out.println("i= "+i);
|
||||
selenium.click("//div[" +i+ "]/div/div[2]/span/span");
|
||||
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);
|
||||
}
|
||||
|
||||
assertTrue(selenium.isTextPresent("Adding succeeded"));
|
||||
Thread.sleep(3000);
|
||||
int status=1;
|
||||
while(!selenium.isTextPresent("Ready"))
|
||||
int status = 1;
|
||||
while (!selenium.isTextPresent("Ready"))
|
||||
{
|
||||
for(int j =1;j<=i;j++)
|
||||
for (int j = 1; j <= i; j++)
|
||||
|
||||
{
|
||||
if (selenium.isTextPresent("Ready"))
|
||||
{
|
||||
status=0;
|
||||
status = 0;
|
||||
break;
|
||||
}
|
||||
selenium.click("//div["+j+"]/div/div[2]/span/span");
|
||||
selenium.click("//div[" + j + "]/div/div[2]/span/span");
|
||||
}
|
||||
if(status==0){
|
||||
if (status == 0) {
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ public class UIScenarioTest extends AbstractSeleniumTestCase {
|
||||
assertTrue(selenium.isTextPresent("admin"));
|
||||
selenium.click("//div[@id='leftmenu_instances']/div");
|
||||
selenium
|
||||
.click("//div[@id='leftmenu_instances_stopped_instances']/div/span");
|
||||
.click("//div[@id='leftmenu_instances_stopped_instances']/div/span");
|
||||
|
||||
Thread.sleep(3000);
|
||||
selenium.click("//div[@id='midmenu_startvm_link']/div/div[2]");
|
||||
@ -52,9 +52,9 @@ public class UIScenarioTest extends AbstractSeleniumTestCase {
|
||||
Thread.sleep(10000);
|
||||
}
|
||||
assertTrue(selenium
|
||||
.isTextPresent("Start Instance action succeeded"));
|
||||
.isTextPresent("Start Instance action succeeded"));
|
||||
selenium
|
||||
.click("//div[@id='leftmenu_instances_running_instances']/div/span");
|
||||
.click("//div[@id='leftmenu_instances_running_instances']/div/span");
|
||||
|
||||
Thread.sleep(3000);
|
||||
selenium.click("//div[@id='midmenu_stopvm_link']/div/div[2]");
|
||||
|
||||
@ -30,15 +30,15 @@ public class ConsoleProxy implements Runnable {
|
||||
private int connectionsMade;
|
||||
private long responseTime;
|
||||
public static final Logger s_logger = Logger.getLogger(ConsoleProxy.class
|
||||
.getClass());
|
||||
.getClass());
|
||||
|
||||
public ConsoleProxy(String port, String sid, String host) {
|
||||
this.command = "https://" + proxyIp
|
||||
+ ".realhostip.com:8000/getscreen?w=100&h=75&host=" + host
|
||||
+ "&port=" + port + "&sid=" + sid;
|
||||
+ ".realhostip.com:8000/getscreen?w=100&h=75&host=" + host
|
||||
+ "&port=" + port + "&sid=" + sid;
|
||||
s_logger.info("Command for a console proxy is " + this.command);
|
||||
this.connectionsMade=0;
|
||||
this.responseTime=0;
|
||||
this.connectionsMade = 0;
|
||||
this.responseTime = 0;
|
||||
}
|
||||
|
||||
public int getConnectionsMade() {
|
||||
@ -50,7 +50,7 @@ public class ConsoleProxy implements Runnable {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while (true){
|
||||
while (true) {
|
||||
|
||||
Script myScript = new Script("wget");
|
||||
myScript.add(command);
|
||||
@ -59,16 +59,16 @@ public class ConsoleProxy implements Runnable {
|
||||
wgetInt process = new wgetInt();
|
||||
String response = myScript.execute(process);
|
||||
long end = process.getEnd();
|
||||
if (response!=null){
|
||||
s_logger.info("Content lenght is incorrect: "+response);
|
||||
if (response != null) {
|
||||
s_logger.info("Content lenght is incorrect: " + response);
|
||||
}
|
||||
|
||||
long duration = (end - begin);
|
||||
this.connectionsMade++;
|
||||
this.responseTime=this.responseTime+duration;
|
||||
try{
|
||||
Thread.sleep(1000);
|
||||
}catch (InterruptedException e){
|
||||
this.responseTime = this.responseTime + duration;
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
}
|
||||
|
||||
@ -97,13 +97,13 @@ public class ConsoleProxy implements Runnable {
|
||||
if (index == -1) {
|
||||
continue;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
int index1 = line.indexOf("Length: 1827");
|
||||
if (index1 == -1) {
|
||||
return status;
|
||||
}
|
||||
else
|
||||
status=line;
|
||||
status = line;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ import java.io.FileOutputStream;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class IpSqlGenerator {
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
if (args.length != 5) {
|
||||
System.out.println("Usage -- generate-ip.sh <public|private> <begin ip range> <end ip range> <data center id> <pod id>");
|
||||
@ -56,7 +56,7 @@ public class IpSqlGenerator {
|
||||
for (int k = ipS3; k <= ipE3; k++) {
|
||||
for (int l = ipS4; l <= ipE4; l++) {
|
||||
out.writeBytes("INSERT INTO `vmops`.`dc_ip_address_alloc` (ip_address, data_center_id, pod_id) VALUES ('"
|
||||
+ i + "." + j + "." + k + "." + l + "'," + dcId + "," + podId + ");\r\n");
|
||||
+ i + "." + j + "." + k + "." + l + "'," + dcId + "," + podId + ");\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ public class IpSqlGenerator {
|
||||
for (int k = ipS3; k <= ipE3; k++) {
|
||||
for (int l = ipS4; l <= ipE4; l++) {
|
||||
out.writeBytes("INSERT INTO `vmops`.`user_ip_address` (ip_address, data_center_id) VALUES ('"
|
||||
+ i + "." + j + "." + k + "." + l + "'," + dcId + ");\r\n");
|
||||
+ i + "." + j + "." + k + "." + l + "'," + dcId + ");\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,57 +22,53 @@ 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;
|
||||
public static final Logger s_logger = Logger.getLogger(ProxyLoadTemp.class.getClass());
|
||||
public static int numThreads = 0;
|
||||
public static ArrayList<ConsoleProxy> proxyList = new ArrayList<ConsoleProxy>();
|
||||
public static long begin;
|
||||
public static long end;
|
||||
public static long sum=0;
|
||||
public static long sum = 0;
|
||||
|
||||
public ProxyLoadTemp(){
|
||||
public ProxyLoadTemp() {
|
||||
}
|
||||
|
||||
public static void main (String[] args){
|
||||
begin= System.currentTimeMillis();
|
||||
public static void main(String[] args) {
|
||||
begin = System.currentTimeMillis();
|
||||
Runtime.getRuntime().addShutdownHook(new ShutdownThread(new ProxyLoadTemp()));
|
||||
ConsoleProxy.proxyIp="172-16-1-101";
|
||||
ConsoleProxy.proxyIp = "172-16-1-101";
|
||||
|
||||
try
|
||||
{
|
||||
BufferedReader consoleInput = new BufferedReader(new FileReader("console.input"));
|
||||
boolean eof = false;
|
||||
s_logger.info("Started reading file");
|
||||
while (!eof){
|
||||
String line = consoleInput.readLine();
|
||||
s_logger.info("Line is "+line);
|
||||
if (line == null){
|
||||
s_logger.info("Line "+numThreads+" is null");
|
||||
eof=true;
|
||||
}
|
||||
else{
|
||||
String[] result=null;
|
||||
try
|
||||
{
|
||||
s_logger.info("Starting parsing line "+line);
|
||||
result= parseLine(line, "[,]");
|
||||
s_logger.info("Line retrieved from the file is "+result[0]+" "+result[1]+" "+result[2]);
|
||||
ConsoleProxy proxy = new ConsoleProxy(result[0], result[1], result[2]);
|
||||
proxyList.add(proxy);
|
||||
new Thread(proxy).start();
|
||||
numThreads++;
|
||||
|
||||
BufferedReader consoleInput = new BufferedReader(new FileReader("console.input"));
|
||||
boolean eof = false;
|
||||
s_logger.info("Started reading file");
|
||||
while (!eof) {
|
||||
String line = consoleInput.readLine();
|
||||
s_logger.info("Line is " + line);
|
||||
if (line == null) {
|
||||
s_logger.info("Line " + numThreads + " is null");
|
||||
eof = true;
|
||||
}
|
||||
catch (Exception ex){
|
||||
s_logger.warn(ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
String[] result = null;
|
||||
try
|
||||
{
|
||||
s_logger.info("Starting parsing line " + line);
|
||||
result = parseLine(line, "[,]");
|
||||
s_logger.info("Line retrieved from the file is " + result[0] + " " + result[1] + " " + result[2]);
|
||||
ConsoleProxy proxy = new ConsoleProxy(result[0], result[1], result[2]);
|
||||
proxyList.add(proxy);
|
||||
new Thread(proxy).start();
|
||||
numThreads++;
|
||||
|
||||
}
|
||||
}catch(Exception e){
|
||||
} catch (Exception ex) {
|
||||
s_logger.warn(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
s_logger.warn(e);
|
||||
}
|
||||
|
||||
@ -80,42 +76,43 @@ 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");
|
||||
|
||||
for (int j=0; j<proxyList.size(); j++){
|
||||
long av=0;
|
||||
if (proxyList.get(j).getConnectionsMade()!=0){
|
||||
av=proxyList.get(j).getResponseTime()/proxyList.get(j).getConnectionsMade();
|
||||
public void run() {
|
||||
s_logger.info("Program was running in " + numThreads + " threads");
|
||||
|
||||
for (int j = 0; j < proxyList.size(); j++) {
|
||||
long av = 0;
|
||||
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");
|
||||
sum=sum+av;
|
||||
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;
|
||||
|
||||
}
|
||||
ProxyLoadTemp.end= System.currentTimeMillis();
|
||||
s_logger.info("Summary for all"+numThreads+" threads: Average response time is "+sum/numThreads+" milliseconds");
|
||||
s_logger.info("Test was running for "+(ProxyLoadTemp.end-ProxyLoadTemp.begin)/1000+" seconds");
|
||||
ProxyLoadTemp.end = System.currentTimeMillis();
|
||||
s_logger.info("Summary for all" + numThreads + " threads: Average response time is " + sum / numThreads + " milliseconds");
|
||||
s_logger.info("Test was running for " + (ProxyLoadTemp.end - ProxyLoadTemp.begin) / 1000 + " seconds");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String[] parseLine(String line, String del) throws Exception
|
||||
{
|
||||
String del1=del.substring(1, del.length()-1);
|
||||
if (line.contains(del1)!=true)
|
||||
String del1 = del.substring(1, del.length() - 1);
|
||||
if (line.contains(del1) != true)
|
||||
{
|
||||
throw new Exception();
|
||||
throw new Exception();
|
||||
}
|
||||
else
|
||||
{
|
||||
String[] token = line.split(del);
|
||||
return token;
|
||||
String[] token = line.split(del);
|
||||
return token;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -38,10 +38,9 @@ public class SignEC2 {
|
||||
public static String command;
|
||||
public static String accessPoint;
|
||||
public static final Logger s_logger = Logger
|
||||
.getLogger(SignRequest.class.getName());
|
||||
.getLogger(SignRequest.class.getName());
|
||||
|
||||
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
// Parameters
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
Iterator<String> iter = argsList.iterator();
|
||||
@ -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,25 +94,23 @@ 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";
|
||||
String temp = "";
|
||||
param.put("AWSAccessKeyId", prop.getProperty("apikey"));
|
||||
param.put("Expires",prop.getProperty("expires"));
|
||||
param.put("Expires", prop.getProperty("expires"));
|
||||
param.put("SignatureMethod", "HmacSHA1");
|
||||
param.put("SignatureVersion", "2");
|
||||
param.put("Version", prop.getProperty("version"));
|
||||
param.put("id", "1");
|
||||
|
||||
StringTokenizer str1 = new StringTokenizer (url, "&");
|
||||
while(str1.hasMoreTokens()) {
|
||||
StringTokenizer str1 = new StringTokenizer(url, "&");
|
||||
while (str1.hasMoreTokens()) {
|
||||
String newEl = str1.nextToken();
|
||||
StringTokenizer str2 = new StringTokenizer(newEl, "=");
|
||||
String name = str2.nextToken();
|
||||
String value= str2.nextToken();
|
||||
String value = str2.nextToken();
|
||||
param.put(name, value);
|
||||
}
|
||||
|
||||
@ -123,8 +119,8 @@ public class SignEC2 {
|
||||
Iterator it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry me = (Map.Entry)it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
try {
|
||||
temp = temp + key + "=" + URLEncoder.encode(value, "UTF-8") + "&";
|
||||
} catch (Exception ex) {
|
||||
@ -132,7 +128,7 @@ public class SignEC2 {
|
||||
}
|
||||
|
||||
}
|
||||
temp = temp.substring(0, temp.length()-1 );
|
||||
temp = temp.substring(0, temp.length() - 1);
|
||||
String requestToSign = req + temp;
|
||||
String signature = UtilsForTest.signRequest(requestToSign, secretkey);
|
||||
String encodedSignature = "";
|
||||
|
||||
@ -31,8 +31,7 @@ public class SignRequest {
|
||||
public static String secretkey;
|
||||
public static String command;
|
||||
|
||||
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
// Parameters
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
Iterator<String> iter = argsList.iterator();
|
||||
@ -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);
|
||||
@ -72,12 +70,12 @@ public class SignRequest {
|
||||
String temp = "";
|
||||
param.put("apikey", apikey);
|
||||
|
||||
StringTokenizer str1 = new StringTokenizer (url, "&");
|
||||
while(str1.hasMoreTokens()) {
|
||||
StringTokenizer str1 = new StringTokenizer(url, "&");
|
||||
while (str1.hasMoreTokens()) {
|
||||
String newEl = str1.nextToken();
|
||||
StringTokenizer str2 = new StringTokenizer(newEl, "=");
|
||||
String name = str2.nextToken();
|
||||
String value= str2.nextToken();
|
||||
String value = str2.nextToken();
|
||||
param.put(name, value);
|
||||
}
|
||||
|
||||
@ -86,8 +84,8 @@ public class SignRequest {
|
||||
Iterator it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry me = (Map.Entry)it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
try {
|
||||
temp = temp + key + "=" + URLEncoder.encode(value, "UTF-8") + "&";
|
||||
} catch (Exception ex) {
|
||||
@ -95,7 +93,7 @@ public class SignRequest {
|
||||
}
|
||||
|
||||
}
|
||||
temp = temp.substring(0, temp.length()-1 );
|
||||
temp = temp.substring(0, temp.length() - 1);
|
||||
String requestToSign = temp.toLowerCase();
|
||||
System.out.println("After sorting: " + requestToSign);
|
||||
String signature = UtilsForTest.signRequest(requestToSign, secretkey);
|
||||
|
||||
@ -22,21 +22,21 @@ import java.io.FileOutputStream;
|
||||
import java.util.Formatter;
|
||||
|
||||
public class SqlDataGenerator {
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
FileOutputStream fs = new FileOutputStream(new File("out.txt"));
|
||||
|
||||
DataOutputStream out = new DataOutputStream(fs);
|
||||
|
||||
for (int i = 20; i < 171; i++) {
|
||||
out.writeBytes("INSERT INTO `vmops`.`dc_ip_address_alloc` (ip_address, data_center_id, pod_id) VALUES ('192.168.2."+i+"',1,1);\r\n");
|
||||
out.writeBytes("INSERT INTO `vmops`.`dc_ip_address_alloc` (ip_address, data_center_id, pod_id) VALUES ('192.168.2." + i + "',1,1);\r\n");
|
||||
}
|
||||
out.writeBytes("\r\n");
|
||||
for (int i = 1; i < 10000; i++) {
|
||||
StringBuilder imagePath = new StringBuilder();
|
||||
Formatter formatter = new Formatter(imagePath);
|
||||
formatter.format("%04x", i);
|
||||
out.writeBytes("INSERT INTO `vmops`.`dc_vnet_alloc` (vnet, data_center_id) VALUES ('"+imagePath.toString()+"',1);\r\n");
|
||||
out.writeBytes("INSERT INTO `vmops`.`dc_vnet_alloc` (vnet, data_center_id) VALUES ('" + imagePath.toString() + "',1);\r\n");
|
||||
}
|
||||
|
||||
out.flush();
|
||||
|
||||
@ -49,10 +49,9 @@ public class SubmitCert {
|
||||
public static String certFileName;
|
||||
public static String cert;
|
||||
public static final Logger s_logger = Logger
|
||||
.getLogger(SubmitCert.class.getName());
|
||||
.getLogger(SubmitCert.class.getName());
|
||||
|
||||
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
// Parameters
|
||||
List<String> argsList = Arrays.asList(args);
|
||||
Iterator<String> iter = argsList.iterator();
|
||||
@ -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";
|
||||
@ -124,17 +122,17 @@ public class SubmitCert {
|
||||
}
|
||||
|
||||
param.put("AWSAccessKeyId", apiKey);
|
||||
param.put("Expires",prop.getProperty("expires"));
|
||||
param.put("SignatureMethod", prop.getProperty("signaturemethod"));
|
||||
param.put("Expires", prop.getProperty("expires"));
|
||||
param.put("SignatureMethod", prop.getProperty("signaturemethod"));
|
||||
param.put("SignatureVersion", "2");
|
||||
param.put("Version", prop.getProperty("version"));
|
||||
|
||||
StringTokenizer str1 = new StringTokenizer (url, "&");
|
||||
while(str1.hasMoreTokens()) {
|
||||
StringTokenizer str1 = new StringTokenizer(url, "&");
|
||||
while (str1.hasMoreTokens()) {
|
||||
String newEl = str1.nextToken();
|
||||
StringTokenizer str2 = new StringTokenizer(newEl, "=");
|
||||
String name = str2.nextToken();
|
||||
String value= str2.nextToken();
|
||||
String value = str2.nextToken();
|
||||
param.put(name, value);
|
||||
}
|
||||
|
||||
@ -143,8 +141,8 @@ public class SubmitCert {
|
||||
Iterator it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry me = (Map.Entry)it.next();
|
||||
String key = (String) me.getKey();
|
||||
String value = (String) me.getValue();
|
||||
String key = (String)me.getKey();
|
||||
String value = (String)me.getValue();
|
||||
try {
|
||||
temp = temp + key + "=" + URLEncoder.encode(value, "UTF-8") + "&";
|
||||
} catch (Exception ex) {
|
||||
@ -152,7 +150,7 @@ public class SubmitCert {
|
||||
}
|
||||
|
||||
}
|
||||
temp = temp.substring(0, temp.length()-1 );
|
||||
temp = temp.substring(0, temp.length() - 1);
|
||||
String requestToSign = req + temp;
|
||||
String signature = UtilsForTest.signRequest(requestToSign, secretKey);
|
||||
String encodedSignature = "";
|
||||
@ -171,10 +169,10 @@ public class SubmitCert {
|
||||
try {
|
||||
StringBuffer fileData = new StringBuffer(1000);
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new FileReader(filePath));
|
||||
new FileReader(filePath));
|
||||
char[] buf = new char[1024];
|
||||
int numRead=0;
|
||||
while((numRead=reader.read(buf)) != -1){
|
||||
int numRead = 0;
|
||||
while ((numRead = reader.read(buf)) != -1) {
|
||||
String readData = String.valueOf(buf, 0, numRead);
|
||||
fileData.append(readData);
|
||||
buf = new char[1024];
|
||||
|
||||
@ -45,7 +45,7 @@ public class TestClient {
|
||||
private static final int MAX_RETRY_LINUX = 5;
|
||||
private static final int MAX_RETRY_WIN = 10;
|
||||
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
String host = "http://localhost";
|
||||
String port = "8080";
|
||||
String testUrl = "/client/test";
|
||||
@ -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")) {
|
||||
@ -92,9 +93,10 @@ public class TestClient {
|
||||
}
|
||||
}
|
||||
|
||||
final String server = host+":"+port+testUrl;
|
||||
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);
|
||||
@ -116,11 +118,11 @@ public class TestClient {
|
||||
if (users != null) {
|
||||
username = users[Math.abs(ran.nextInt()) % numOfUsers];
|
||||
} else {
|
||||
username = Math.abs(ran.nextInt())+"-user";
|
||||
username = Math.abs(ran.nextInt()) + "-user";
|
||||
}
|
||||
NDC.push(username);
|
||||
|
||||
String url = server+"?email="+username+"&password="+username+"&command=deploy";
|
||||
String url = server + "?email=" + username + "&password=" + username + "&command=deploy";
|
||||
s_logger.info("Launching test for user: " + username + " with url: " + url);
|
||||
HttpClient client = new HttpClient();
|
||||
HttpMethod method = new GetMethod(url);
|
||||
@ -155,10 +157,10 @@ public class TestClient {
|
||||
}
|
||||
if (users == null) {
|
||||
s_logger.info("Sending cleanup command");
|
||||
url = server+"?email="+username+"&password="+username+"&command=cleanup";
|
||||
url = server + "?email=" + username + "&password=" + username + "&command=cleanup";
|
||||
} else {
|
||||
s_logger.info("Sending stop DomR / destroy VM command");
|
||||
url = server+"?email="+username+"&password="+username+"&command=stopDomR";
|
||||
url = server + "?email=" + username + "&password=" + username + "&command=stopDomR";
|
||||
}
|
||||
method = new GetMethod(url);
|
||||
responseCode = client.executeMethod(method);
|
||||
@ -170,27 +172,28 @@ public class TestClient {
|
||||
} else {
|
||||
// Just stop but don't destroy the VMs/Routers
|
||||
s_logger.info("SSH test failed with reason '" + reason + "', stopping VMs");
|
||||
url = server+"?email="+username+"&password="+username+"&command=stop";
|
||||
url = server + "?email=" + username + "&password=" + username + "&command=stop";
|
||||
responseCode = client.executeMethod(new GetMethod(url));
|
||||
}
|
||||
} else {
|
||||
// Just stop but don't destroy the VMs/Routers
|
||||
reason = method.getStatusText();
|
||||
s_logger.info("Deploy test failed with reason '" + reason + "', stopping VMs");
|
||||
url = server+"?email="+username+"&password="+username+"&command=stop";
|
||||
url = server + "?email=" + username + "&password=" + username + "&command=stop";
|
||||
client.executeMethod(new GetMethod(url));
|
||||
}
|
||||
|
||||
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);
|
||||
try {
|
||||
HttpClient client = new HttpClient();
|
||||
String url = server+"?email="+username+"&password="+username+"&command=stop";
|
||||
String url = server + "?email=" + username + "&password=" + username + "&command=stop";
|
||||
client.executeMethod(new GetMethod(url));
|
||||
} catch (Exception e1) {
|
||||
}
|
||||
@ -248,7 +251,7 @@ public class TestClient {
|
||||
while (true) {
|
||||
if ((stdout.available() == 0) && (stderr.available() == 0)) {
|
||||
int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA
|
||||
| ChannelCondition.EOF, 120000);
|
||||
| ChannelCondition.EOF, 120000);
|
||||
|
||||
if ((conditions & ChannelCondition.TIMEOUT) != 0) {
|
||||
s_logger.info("Timeout while waiting for data from peer.");
|
||||
@ -333,7 +336,7 @@ public class TestClient {
|
||||
while (true) {
|
||||
if ((stdout.available() == 0) && (stderr.available() == 0)) {
|
||||
int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA
|
||||
| ChannelCondition.EOF, 120000);
|
||||
| ChannelCondition.EOF, 120000);
|
||||
|
||||
if ((conditions & ChannelCondition.TIMEOUT) != 0) {
|
||||
s_logger.info("Timeout while waiting for data from peer.");
|
||||
|
||||
@ -41,25 +41,25 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
public class UtilsForTest {
|
||||
|
||||
private static DocumentBuilderFactory factory = DocumentBuilderFactory
|
||||
.newInstance();
|
||||
.newInstance();
|
||||
|
||||
public static boolean verifyTags (Map<String, String> params) {
|
||||
public static boolean verifyTags(Map<String, String> params) {
|
||||
boolean result = true;
|
||||
for (String value : params.keySet()) {
|
||||
if (params.get(value) == null) {
|
||||
result=false;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean verifyTagValues (Map<String, String> params, Map<String, String> pattern) {
|
||||
public static boolean verifyTagValues(Map<String, String> params, Map<String, String> pattern) {
|
||||
boolean result = true;
|
||||
|
||||
if (pattern != null) {
|
||||
for (String value : pattern.keySet()) {
|
||||
if (!pattern.get(value).equals(params.get(value))) {
|
||||
result=false;
|
||||
result = false;
|
||||
System.out.println("Tag " + value + " has " + params.get(value) + " while expected value is: " + pattern.get(value));
|
||||
}
|
||||
}
|
||||
@ -67,9 +67,8 @@ public class UtilsForTest {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, String> parseXML(InputStream is,
|
||||
String[] tagNames) {
|
||||
String[] tagNames) {
|
||||
Map<String, String> returnValues = new HashMap<String, String>();
|
||||
try {
|
||||
DocumentBuilder docBuilder = factory.newDocumentBuilder();
|
||||
@ -78,14 +77,14 @@ public class UtilsForTest {
|
||||
|
||||
for (int i = 0; i < tagNames.length; i++) {
|
||||
NodeList targetNodes = rootElement
|
||||
.getElementsByTagName(tagNames[i]);
|
||||
.getElementsByTagName(tagNames[i]);
|
||||
if (targetNodes.getLength() <= 0) {
|
||||
System.out.println("no " + tagNames[i]
|
||||
+ " tag in the response");
|
||||
+ " tag in the response");
|
||||
returnValues.put(tagNames[i], null);
|
||||
} else {
|
||||
returnValues.put(tagNames[i], targetNodes.item(0)
|
||||
.getTextContent());
|
||||
.getTextContent());
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@ -95,9 +94,8 @@ 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>>();
|
||||
public static ArrayList<HashMap<String, String>> parseMulXML(InputStream is, String[] tagNames) {
|
||||
ArrayList<HashMap<String, String>> returnValues = new ArrayList<HashMap<String, String>>();
|
||||
|
||||
try {
|
||||
DocumentBuilder docBuilder = factory.newDocumentBuilder();
|
||||
@ -105,17 +103,17 @@ public class UtilsForTest {
|
||||
Element rootElement = doc.getDocumentElement();
|
||||
for (int i = 0; i < tagNames.length; i++) {
|
||||
NodeList targetNodes = rootElement
|
||||
.getElementsByTagName(tagNames[i]);
|
||||
.getElementsByTagName(tagNames[i]);
|
||||
if (targetNodes.getLength() <= 0) {
|
||||
System.out.println("no " + tagNames[i]
|
||||
+ " tag in XML response...returning null");
|
||||
+ " tag in XML response...returning null");
|
||||
} else {
|
||||
for (int j = 0; j < targetNodes.getLength(); j++) {
|
||||
HashMap<String, String> valueList = new HashMap<String,String> ();
|
||||
HashMap<String, String> valueList = new HashMap<String, String>();
|
||||
Node node = targetNodes.item(j);
|
||||
//parse child nodes
|
||||
NodeList child = node.getChildNodes();
|
||||
for (int c=0; c<node.getChildNodes().getLength(); c++){
|
||||
for (int c = 0; c < node.getChildNodes().getLength(); c++) {
|
||||
child.item(c).getNodeName();
|
||||
valueList.put(child.item(c).getNodeName(), child.item(c).getTextContent());
|
||||
}
|
||||
@ -131,7 +129,6 @@ public class UtilsForTest {
|
||||
return returnValues;
|
||||
}
|
||||
|
||||
|
||||
public static String createMD5String(String password) {
|
||||
MessageDigest md5;
|
||||
try {
|
||||
@ -154,14 +151,8 @@ public class UtilsForTest {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static Map<String, String> getSingleValueFromXML(InputStream is,
|
||||
String[] tagNames) {
|
||||
String[] tagNames) {
|
||||
Map<String, String> returnValues = new HashMap<String, String>();
|
||||
try {
|
||||
DocumentBuilder docBuilder = factory.newDocumentBuilder();
|
||||
@ -170,13 +161,13 @@ public class UtilsForTest {
|
||||
|
||||
for (int i = 0; i < tagNames.length; i++) {
|
||||
NodeList targetNodes = rootElement
|
||||
.getElementsByTagName(tagNames[i]);
|
||||
.getElementsByTagName(tagNames[i]);
|
||||
if (targetNodes.getLength() <= 0) {
|
||||
System.out.println("no " + tagNames[i]
|
||||
+ " tag in XML response...returning null");
|
||||
+ " tag in XML response...returning null");
|
||||
} else {
|
||||
returnValues.put(tagNames[i], targetNodes.item(0)
|
||||
.getTextContent());
|
||||
.getTextContent());
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@ -186,9 +177,8 @@ public class UtilsForTest {
|
||||
return returnValues;
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, List<String>> getMultipleValuesFromXML(
|
||||
InputStream is, String[] tagNames) {
|
||||
InputStream is, String[] tagNames) {
|
||||
Map<String, List<String>> returnValues = new HashMap<String, List<String>>();
|
||||
try {
|
||||
DocumentBuilder docBuilder = factory.newDocumentBuilder();
|
||||
@ -196,10 +186,10 @@ public class UtilsForTest {
|
||||
Element rootElement = doc.getDocumentElement();
|
||||
for (int i = 0; i < tagNames.length; i++) {
|
||||
NodeList targetNodes = rootElement
|
||||
.getElementsByTagName(tagNames[i]);
|
||||
.getElementsByTagName(tagNames[i]);
|
||||
if (targetNodes.getLength() <= 0) {
|
||||
System.out.println("no " + tagNames[i]
|
||||
+ " tag in XML response...returning null");
|
||||
+ " tag in XML response...returning null");
|
||||
} else {
|
||||
List<String> valueList = new ArrayList<String>();
|
||||
for (int j = 0; j < targetNodes.getLength(); j++) {
|
||||
@ -215,13 +205,11 @@ public class UtilsForTest {
|
||||
return returnValues;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String signRequest(String request, String key) {
|
||||
try {
|
||||
Mac mac = Mac.getInstance("HmacSHA1");
|
||||
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(),
|
||||
"HmacSHA1");
|
||||
"HmacSHA1");
|
||||
mac.init(keySpec);
|
||||
mac.update(request.getBytes());
|
||||
byte[] encryptedBytes = mac.doFinal();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user