コード例 #1
0
        public void CreateAndDeleteBucketSecondRegionTest()
        {
            var settings = AccountSettings.Load();

            //point to region (Beijing) other than Hangzhou
            settings.OssEndpoint = Config.SecondEndpoint;
            var ossClient = OssClientFactory.CreateOssClient(settings);

            //get a random bucketName
            var bucketName = OssTestUtils.GetBucketName(_className);

            //assert bucket does not exist
            Assert.IsFalse(OssTestUtils.BucketExists(ossClient, bucketName),
                           string.Format("Bucket {0} should not exist before creation", bucketName));

            //create a new bucket
            ossClient.CreateBucket(bucketName);
            OssTestUtils.WaitForCacheExpire();
            Assert.IsTrue(OssTestUtils.BucketExists(ossClient, bucketName),
                          string.Format("Bucket {0} should exist after creation", bucketName));

            //delete the bucket
            ossClient.DeleteBucket(bucketName);
            OssTestUtils.WaitForCacheExpire();
            Assert.IsFalse(OssTestUtils.BucketExists(ossClient, bucketName),
                           string.Format("Bucket {0} should not exist after deletion", bucketName));
        }
コード例 #2
0
        public void CreateBucketWithDuplicatedNameDifferentLocationTest()
        {
            //get a random bucketName
            var bucketName = OssTestUtils.GetBucketName(_className);

            var settings = AccountSettings.Load();

            //point to location (Beijing) other than Hangzhou
            settings.OssEndpoint = Config.SecondEndpoint;
            var ossSecondClient = OssClientFactory.CreateOssClient(settings);

            //create the bucket
            _ossClient.CreateBucket(bucketName);

            try
            {
                //TODO: due to 5596363, user can see buckets in all regions, though only specify one region
                //assert bucket does not exist
                //Assert.IsFalse(OssTestUtils.BucketExists(ossSecondClient, bucketName));
                Assert.IsTrue(OssTestUtils.BucketExists(ossSecondClient, bucketName));
                //try to create bucket with same name on different location
                ossSecondClient.CreateBucket(bucketName);
                Assert.Fail("Bucket creation should be failed with dup name and different location");
            }
            catch (OssException e)
            {
                Assert.AreEqual(OssErrorCode.BucketAlreadyExists, e.ErrorCode);
            }
            finally
            {
                _ossClient.DeleteBucket(bucketName);
            }
        }
コード例 #3
0
ファイル: Facade.cs プロジェクト: shekky/MailSystem.NET
 public Facade()
 {
     this._accSettings    = AccountSettings.Load(Constants.ACCOUNT_FILE_NAME_SETTINGS);
     this.popController   = new Pop3Controller();
     this._imapController = new ImapController();
     this.smtpController  = new SmtpController();
     this._changeImcoming = false;
 }
コード例 #4
0
    private void loadAccontSettings()
    {
        this.acc = AccountSettings.Load("AccountSettings");
        //AccountSettings.AccountInfo acc_info = (AccountSettings.AccountInfo)((IEnumerator)this.acc.Accounts.GetEnumerator()).Current;

        AccountSettings.AccountInfo [] arrayAcc_info = this.acc.Accounts;

        if (arrayAcc_info != null)
        {
            AccountSettings.AccountInfo acc_info = arrayAcc_info[0];

            if (acc_info != null)
            {
                TextBoxPassword.Text    = acc_info.Password;
                TextBoxDisplayName.Text = acc_info.DisplayName;

                int i = 0;
                foreach (ListItem item in DropDownListIncomingServer.Items)
                {
                    if (item.Text == acc_info.IncomingMailServer)
                    {
                        DropDownListIncomingServer.SelectedIndex = i;
                    }
                    i++;
                }

                TextBoxEmailAddress.Text               = acc_info.EmailAddress;
                TextBoxOutgoingServer.Text             = acc_info.OutgoingServer;
                TextBoxLoginID.Text                    = acc_info.LoginId;
                TextBoxPortIncoming.Text               = acc_info.PortIncomingServer.ToString();
                TextBoxPortOutgoing.Text               = acc_info.PortOutgoingServer.ToString();
                CheckBoxSecureConnection.Checked       = acc_info.IsIncomeSecureConnection;
                CheckBoxOutgoingSecure.Checked         = acc_info.IsOutgoingSecureConnection;
                CheckBoxOutgoingAuthentication.Checked = acc_info.IsOutgoingWithAuthentication;
                CheckBoxPortIncoming.Checked           = acc_info.PortIncomingChecked;
                CheckBoxPortOutgoing.Checked           = acc_info.PortOutgoingChecked;
            }
        }
    }
コード例 #5
0
        public void CreateAndDeleteBucketDefaultRegionTest()
        {
            var settings = AccountSettings.Load();
            //point to default region
            var ossClient = new OssClient(settings.OssEndpoint, settings.OssAccessKeyId, settings.OssAccessKeySecret);

            //get a random bucketName
            var bucketName = OssTestUtils.GetBucketName(_className);

            //assert bucket does not exist
            Assert.IsFalse(OssTestUtils.BucketExists(ossClient, bucketName),
                           string.Format("Bucket {0} should not exist before creation", bucketName));

            //create a new bucket
            ossClient.CreateBucket(bucketName);
            Assert.IsTrue(ossClient.DoesBucketExist(bucketName),
                          string.Format("Bucket {0} should exist after creation", bucketName));

            //delete the bucket
            ossClient.DeleteBucket(bucketName);
            Assert.IsFalse(ossClient.DoesBucketExist(bucketName),
                           string.Format("Bucket {0} should not exist after deletion", bucketName));
        }
コード例 #6
0
 public static AccountSettings.AccountInfo getArrayAccountInfo()
 {
     return(AccountSettings.Load("AccountSettings").Acc_Info);
 }