Example #1
0
 public void Setup()
 {
     try
     {
         _client = Ds3TestUtils.CreateClient();
         Guid dataPolicyId = TempStorageUtil.SetupDataPolicy(FixtureName, false, ChecksumType.Type.MD5, _client);
         EnvStorageIds = TempStorageUtil.Setup(FixtureName, dataPolicyId, _client);
     }
     catch (Exception)
     {
         // So long as any SetUp method runs without error, the TearDown method is guaranteed to run.
         // It will not run if a SetUp method fails or throws an exception.
         Teardown();
         throw;
     }
 }
        public void Startup()
        {
            try
            {
                this._client = Ds3Builder.FromEnv().WithProxy(new Uri("http://localhost:9090")).Build();

                var dataPolicyId = TempStorageUtil.SetupDataPolicy(FixtureName, false, ChecksumType.Type.MD5, _client);
                _envStorageIds = TempStorageUtil.Setup(FixtureName, dataPolicyId, _client);
            }
            catch (Exception)
            {
                // So long as any SetUp method runs without error, the TearDown method is guaranteed to run.
                // It will not run if a SetUp method fails or throws an exception.
                Teardown();
                throw;
            }
        }
        public void Startup()
        {
            try
            {
                this._client = Ds3TestUtils.CreateClient(this._copyBufferSize);
                this._helpers = new Ds3ClientHelpers(this._client);

                var dataPolicyId = TempStorageUtil.SetupDataPolicy(FixtureName, false, ChecksumType.Type.MD5, _client);
                _envStorageIds = TempStorageUtil.Setup(FixtureName, dataPolicyId, _client);
            }
            catch (Exception)
            {
                // So long as any SetUp method runs without error, the TearDown method is guaranteed to run.
                // It will not run if a SetUp method fails or throws an exception.
                Teardown();
                throw;
            }
        }
Example #4
0
        /// <summary>
        /// Tears down the temporary test environment
        /// </summary>
        /// <param name="fixtureName"></param>
        /// <param name="ids"></param>
        /// <param name="client"></param>
        public static void TearDown(
            string fixtureName,
            TempStorageIds ids,
            IDs3Client client)
        {
            //try to delete as much as possible

            var exceptionsThrown = new Queue<Exception>();

            try
            {
                ABMTestHelper.DeleteDataPersistenceRule(ids.DataPersistenceRuleId, client);
            }
            catch (Exception ex)
            {
                exceptionsThrown.Enqueue(ex);
            }

            try
            {
                ABMTestHelper.DeleteDataPolicy(fixtureName, client);
            }
            catch (Exception ex)
            {
                exceptionsThrown.Enqueue(ex);
            }

            try
            {
                ABMTestHelper.DeleteStorageDomainMember(ids.StorageDomainMemberId, client);
            }
            catch (Exception ex)
            {
                exceptionsThrown.Enqueue(ex);
            }

            try
            {
                ABMTestHelper.DeleteStorageDomain(fixtureName, client);
            }
            catch (Exception ex)
            {
                exceptionsThrown.Enqueue(ex);
            }

            try
            {
                ABMTestHelper.DeletePoolPartition(fixtureName, client);
            }
            catch (Exception ex)
            {
                exceptionsThrown.Enqueue(ex);
            }

            if (exceptionsThrown.Count > 0)
            {
                throw new AggregateException(exceptionsThrown);
            }
        }