public void PutFileObjectTest() { // Get the client details from the stored client details (rather than embed secret keys in the test). // Ensure that your AWS/Secret keys have been stored before running. var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); S3Helper helper = new S3Helper(clientDetails); const string bucketName = "ExampleTestBucket"; const string key = "ExampleObject"; // Put a simple text object into the bucket to delete. helper.CreateBucket(bucketName); try { helper.PutFileObject(bucketName, key, @"C:\Temp\IMD.WebSite.zip"); } catch (Exception ex) { } finally { //helper.DeleteObject(bucketName, key); //helper.DeleteBucket(bucketName); } }
public void DeleteObject_Should_Succeed() { // Get the client details from the stored client details (rather than embed secret keys in the test). // Ensure that your AWS/Secret keys have been stored before running. var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); S3Helper helper = new S3Helper(clientDetails); const string bucketName = "ExampleTestBucket"; const string key = "ExampleObject"; // Put a simple text object into the bucket to delete. helper.CreateBucket(bucketName); helper.PutTextObject(bucketName, key, "Example text to store in the object"); try { helper.DeleteObject(bucketName, key); } finally { helper.DeleteBucket(bucketName); } }
protected virtual AwsClientDetails GetClientDetails() { var clientDetailsStore = new ClientDetailsStore(); AwsClientDetails clientDetails = clientDetailsStore.Load(EncryptionContainerName); Log.LogMessage(MessageImportance.Normal, "Connecting to AWS using AwsAccessKeyId: {0}", clientDetails.AwsAccessKeyId); return clientDetails; }
public void AssociateIpAddressWithInstance_Should_Succeed() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); EC2Helper ec2Helper = new EC2Helper(clientDetails); ec2Helper.AssociateIpAddress(DefaultInstanceId, DefaultIpAddress); }
public void CreateDomain_Should_Succeed() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SimpleDBHelper helper = new SimpleDBHelper(clientDetails); const string domainName = "TestDomain"; helper.CreateDomain(domainName); }
public void DeleteBucket_Should_Succeed() { // Get the client details from the stored client details (rather than embed secret keys in the test). // Ensure that your AWS/Secret keys have been stored before running. var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); S3Helper helper = new S3Helper(clientDetails); helper.DeleteBucket("ExampleTestBucket"); }
public void ListTopics_Should_ReturnTopics() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); string[] topics = helper.ListTopics(""); Assert.AreEqual(2, topics.Length); }
public void CreateNewVolume_Should_CreateNewVolume() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); EC2Helper ec2Helper = new EC2Helper(clientDetails); // Create a 2Gb volumne. string volumeId = ec2Helper.CreateNewVolume("us-east-1b", "2"); // "us-east-1b" Assert.IsNotEmpty(volumeId, "Expected VolumeId"); }
public void CreateQueueTwice_Should_Succeed() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SQSHelper helper = new SQSHelper(clientDetails); string url1 = helper.CreateQueue("TestQ2"); string url2 = helper.CreateQueue("TestQ2"); Assert.AreEqual(url1, url2, "Url's should match"); }
public void DeleteQueue_Should_DeleteQueue() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SQSHelper helper = new SQSHelper(clientDetails); // Qreate a queue to delete. string queueUrl = helper.CreateQueue("TestQ"); helper.DeleteQueue(queueUrl); }
public void CreateTopicTwice_Should_Succeed_WithMatchingArns() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); string topicArn = helper.CreateTopic("TestTopic2"); string topicArn2 = helper.CreateTopic("TestTopic2"); Assert.AreEqual(topicArn, topicArn2, "Topic Arn's should match"); }
public void Publish_Should_PublishANotification() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); const string topicArn = "arn:aws:sns:us-east-1:167532394791:TestTopic"; string messageId = helper.Publish(topicArn, "Test", "This is a test of Publish..."); Assert.IsNotEmpty(messageId); }
public void CreateTopic_Should_CreateTopic() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); string topicId = helper.CreateTopic("TestTopic"); System.Diagnostics.Debug.WriteLine("Topic Id: " + topicId); Assert.IsNotEmpty(topicId); }
public void AttachVolumeToInstance_Should_AttachVolume() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); EC2Helper ec2Helper = new EC2Helper(clientDetails); const string device = "xvdf"; const string volumeId = "vol-6bd56a02"; const string instanceId = "i-6de0a406"; ec2Helper.AttachVolume(device, instanceId, volumeId); }
public void CreateQueue_Should_CreateQueue() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SQSHelper helper = new SQSHelper(clientDetails); string queueUrl = helper.CreateQueue("TestQ"); System.Diagnostics.Debug.WriteLine(queueUrl, "queueUrl:"); Assert.IsNotEmpty(queueUrl); }
public void CreateSnapShotFromVolume_Should_CreateSnapShot() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); EC2Helper ec2Helper = new EC2Helper(clientDetails); const string volumeId = "vol-d1e15eb8"; const string description = "Test SnapShot"; // Create a 2Gb volumne. string snapShotId = ec2Helper.CreateSnapShot(volumeId, description); Assert.IsNotEmpty(snapShotId, "Expected SnapShot Id"); }
public void DeleteAttributes_Should_Succeed() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SimpleDBHelper helper = new SimpleDBHelper(clientDetails); const string domainName = "TestDomain"; const string itemName = "TesItem"; const string attributeName = "attributeName"; string expectedValue = DateTime.Now.ToLongTimeString(); // Ensure the domain exists and store the test item. helper.CreateDomain(domainName); helper.PutAttribute(domainName, itemName, attributeName, true, expectedValue); helper.DeleteAttributes(domainName, itemName, new [] { attributeName }); }
public void SaveAndLoadClientDetails_AreCorrectlyStored() { const string containerName = "S3BuildPublisher.TestContainer.ClientDetailsStore"; var clientDetails = new AwsClientDetails { AwsAccessKeyId = "AwsAccessKeyId", AwsSecretAccessKey = "AwsSecretAccessKey" }; var store = new ClientDetailsStore(DefaultTestRegistrySubKey); store.Save(containerName, clientDetails); AwsClientDetails actual = store.Load(containerName); Assert.AreEqual(clientDetails.AwsAccessKeyId, actual.AwsAccessKeyId, "AwsAccessKeyId"); Assert.AreEqual(clientDetails.AwsSecretAccessKey, actual.AwsSecretAccessKey, "AwsSecretAccessKey"); }
public void TestAddPermission_Sets_PermissionsOnTopic() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SNSHelper helper = new SNSHelper(clientDetails); string topicArn = helper.CreateTopic("TestSetPermissionsTopic"); // TODO: Replace this with a valid AWS account Id. string[] awsAccountIds = new[] { "123456789012" }; string[] actionNames = new[] { "*" }; const string label = "Test Topic Permissions"; // There appears to be an issue with the AWS SDK 1.0.8.1 which failes validation // for action names and aws account ids whilst they are valid. helper.AddPermission(actionNames, awsAccountIds, label, topicArn); // Now clean up and delete the topic. helper.DeleteTopic(topicArn); }
public void ReceiveMessage_Should_ReceiveMessageAndNotRemoveIt() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SQSHelper helper = new SQSHelper(clientDetails); string queueUrl = helper.CreateQueue("TestQ"); // Add a message to the queue to ensure that their is one and wait for 2 seconds to allow // the message to propogate. // Add the time on to ensure the correct message is received. string expectedMessage = "Sample test message " + DateTime.Now.ToLongTimeString(); helper.SendMessage(expectedMessage, queueUrl); // Messages can be very slow to appear on the queue. Thread.Sleep(60000); // Get the sent message. Amazon.SQS.Model.Message message = helper.ReceiveMessage(queueUrl); Assert.IsNotNull(message, "No messages"); try { Assert.AreEqual(expectedMessage, message.Body, "Expected message body first time"); // Ensure that we can get the message a second time. Amazon.SQS.Model.Message message2 = helper.ReceiveMessage(queueUrl); Assert.IsNotNull(message2, "Message should not have been removed."); Assert.AreEqual(expectedMessage, message2.Body, "Expected message body second time"); } finally { // Delete the message. helper.DeleteMessage(queueUrl, message.ReceiptHandle); } }
public void PutAttrubute_Should_Succeed() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SimpleDBHelper helper = new SimpleDBHelper(clientDetails); const string domainName = "TestDomain"; const string itemName = "TesItem"; const string name = "attributeName"; const bool replace = true; string value = DateTime.Now.ToLongTimeString(); helper.PutAttribute(domainName, itemName, name, replace, value); }
public void GetUnknownAttribute_Should_ReturnEmptyString() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SimpleDBHelper helper = new SimpleDBHelper(clientDetails); const string domainName = "TestDomain"; const string itemName = "TesItem"; const string attributeName = "UnknownAttributeThatDoesntExist"; string expectedValue = string.Empty; // Ensure the domain exists and store the test item. helper.CreateDomain(domainName); string actualValue = helper.GetAttribute(domainName, itemName, attributeName); Assert.AreEqual(expectedValue, actualValue); }
public void Reboot_Should_RebootInstance() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); EC2Helper ec2Helper = new EC2Helper(clientDetails); // TODO: this instanceId will change based on the Run Instance test. ec2Helper.RebootInstance(new string[] { "i-4501472e" }); }
public void RunInstance_Should_RunInstance() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); EC2Helper ec2Helper = new EC2Helper(clientDetails); // Modify these to match your own AWS settings. const string ami = "ami-bfab42d6"; const string keyPair = "BookSwapPair1"; const string securityGroup = "Basic"; const string userData = ""; const string availabilityZone = "us-east-1a"; List<string> instances = ec2Helper.RunInstance(ami, 1, keyPair, userData, new string[] { securityGroup }, availabilityZone); Assert.IsNotEmpty(instances); }
public void WaitForMessage_Should_ThrowTimeoutException() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SQSHelper helper = new SQSHelper(clientDetails); string queueUrl = helper.CreateQueue("TestQ"); // Get the sent message. helper.WaitForMessage(queueUrl, 10, 5); }
public void SendMessage_Should_ReturnMessageId() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); SQSHelper helper = new SQSHelper(clientDetails); const string messageBody = "TestMessageBody"; string queueUrl = helper.CreateQueue("TestQ"); string messageId = helper.SendMessage(messageBody, queueUrl); Assert.IsNotEmpty(messageId); }
public void CreateVolumeFromSnapShot_Should_CreateNewVolume() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); EC2Helper ec2Helper = new EC2Helper(clientDetails); const string availabilityZone = "us-east-1b"; const string snapShotId = "snap-422c832a"; // Create a 2Gb volumne. string volumeId = ec2Helper.CreateVolumeFromSnapshot(availabilityZone, snapShotId); Assert.IsNotEmpty(volumeId, "Expected VolumeId"); }
public void StartInstances_Should_Start_Instance() { // Get the client details from the stored client details (rather than embed secret keys in the test). // Ensure that your AWS/Secret keys have been stored before running. var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); EC2Helper ec2Helper = new EC2Helper(clientDetails); ec2Helper.StartInstances(new string[] { DefaultInstanceId }); }
public void StopInstances_Should_Stop_Instance() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); EC2Helper ec2Helper = new EC2Helper(clientDetails); ec2Helper.StopInstances(new string[] { DefaultInstanceId }); }
public void TerminateInstnace_Should_TerminateInstance() { var store = new ClientDetailsStore(); AwsClientDetails clientDetails = store.Load(Container); EC2Helper ec2Helper = new EC2Helper(clientDetails); // TODO: this instanceId will change based on the Run Instance test. ec2Helper.TerminateInstance(new string[] { "i-6503450e" }); }