当前位置: 首页>>代码示例>>C#>>正文


C# CloudFilesProvider.CopyObject方法代码示例

本文整理汇总了C#中net.openstack.Providers.Rackspace.CloudFilesProvider.CopyObject方法的典型用法代码示例。如果您正苦于以下问题:C# CloudFilesProvider.CopyObject方法的具体用法?C# CloudFilesProvider.CopyObject怎么用?C# CloudFilesProvider.CopyObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.openstack.Providers.Rackspace.CloudFilesProvider的用法示例。


在下文中一共展示了CloudFilesProvider.CopyObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_Copy_Object_When_Passing_Content_Length

        public void Should_Copy_Object_When_Passing_Content_Length()
        {
            Dictionary<string, string> header = new Dictionary<string, string>();
            header.Add(CloudFilesProvider.ContentLength, "62504");

            var provider = new CloudFilesProvider();
            var copyResponse = provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName, header, identity: _testIdentity);

            Assert.AreEqual(ObjectStore.ObjectCreated, copyResponse);
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:10,代码来源:CloudFilesTests.cs

示例2: Should_Copy_Object_When_Not_Passing_Content_Length_And_Passing_Expiring_Header

        public void Should_Copy_Object_When_Not_Passing_Content_Length_And_Passing_Expiring_Header()
        {
            // Object will expire 2 days from now.
            int epoch = (int)(DateTime.UtcNow.AddDays(2) - new DateTime(1970, 1, 1)).TotalSeconds;

            Dictionary<string, string> header = new Dictionary<string, string>();
            header.Add(CloudFilesProvider.ObjectDeleteAt, epoch.ToString());

            var provider = new CloudFilesProvider();
            var copyResponse = provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName, header, identity: _testIdentity);

            Assert.AreEqual(ObjectStore.ObjectCreated, copyResponse);

        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:14,代码来源:CloudFilesTests.cs

示例3: Should_Copy_Object_When_Not_Passing_Content_Length

        public void Should_Copy_Object_When_Not_Passing_Content_Length()
        {
            var provider = new CloudFilesProvider();
            var copyResponse = provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName, identity: _testIdentity);

            Assert.AreEqual(ObjectStore.ObjectCreated, copyResponse);
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:7,代码来源:CloudFilesTests.cs

示例4: Should_Copy_Object_When_Not_Passing_Content_Length_And_Passing_Expiring_Header

        public void Should_Copy_Object_When_Not_Passing_Content_Length_And_Passing_Expiring_Header()
        {
            // Object will expire 2 days from now.
            var epoch = (int)(DateTime.UtcNow.AddDays(2) - new DateTime(1970, 1, 1)).TotalSeconds;

            var header = new Dictionary<string, string> { { CloudFilesProvider.ObjectDeleteAt, epoch.ToString() } };

            var provider = new CloudFilesProvider(_testIdentity);
            var copyResponse = provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName, header);

            Assert.AreEqual(ObjectStore.ObjectCreated, copyResponse);

            var sourceheader = provider.GetObjectHeaders(sourceContainerName, sourceObjectName);
            var destinationHeader = provider.GetObjectHeaders(destinationContainerName, destinationObjectName);

            Assert.AreEqual(sourceheader.First(h => h.Key.Equals("ETag", StringComparison.OrdinalIgnoreCase)).Value, destinationHeader.First(h => h.Key.Equals("ETag", StringComparison.OrdinalIgnoreCase)).Value);
            Assert.AreEqual(sourceheader.First(h => h.Key.Equals("Content-Length", StringComparison.OrdinalIgnoreCase)).Value, destinationHeader.First(h => h.Key.Equals("Content-Length", StringComparison.OrdinalIgnoreCase)).Value);

        }
开发者ID:jonwalton,项目名称:openstack.net,代码行数:19,代码来源:CloudFilesTests.cs

示例5: Should_Copy_Object_When_Passing_Content_Length

        public void Should_Copy_Object_When_Passing_Content_Length()
        {
            var provider = new CloudFilesProvider(_testIdentity);
            var copyResponse = provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName);

            Assert.AreEqual(ObjectStore.ObjectCreated, copyResponse);

            var sourceheader = provider.GetObjectHeaders(sourceContainerName, sourceObjectName);
            var destinationHeader = provider.GetObjectHeaders(destinationContainerName, destinationObjectName);

            Assert.AreEqual(sourceheader.First(h => h.Key.Equals("ETag", StringComparison.OrdinalIgnoreCase)).Value, destinationHeader.First(h => h.Key.Equals("ETag", StringComparison.OrdinalIgnoreCase)).Value);
            Assert.AreEqual(sourceheader.First(h => h.Key.Equals("Content-Length", StringComparison.OrdinalIgnoreCase)).Value, destinationHeader.First(h => h.Key.Equals("Content-Length", StringComparison.OrdinalIgnoreCase)).Value);
        }
开发者ID:jonwalton,项目名称:openstack.net,代码行数:13,代码来源:CloudFilesTests.cs

示例6: TestCopyObject

        public void TestCopyObject()
        {
            IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
            string containerName = TestContainerPrefix + Path.GetRandomFileName();
            string objectName = Path.GetRandomFileName();
            string copiedName = Path.GetRandomFileName();
            // another random name counts as random content
            string fileData = Path.GetRandomFileName();
            string contentType = "text/plain-jane";

            ObjectStore containerResult = provider.CreateContainer(containerName);
            Assert.AreEqual(ObjectStore.ContainerCreated, containerResult);

            using (MemoryStream uploadStream = new MemoryStream(Encoding.UTF8.GetBytes(fileData)))
            {
                provider.CreateObject(containerName, uploadStream, objectName, contentType);
            }

            string actualData = ReadAllObjectText(provider, containerName, objectName, Encoding.UTF8);
            Assert.AreEqual(fileData, actualData);

            provider.CopyObject(containerName, objectName, containerName, copiedName);

            // make sure the item is available at the copied location
            actualData = ReadAllObjectText(provider, containerName, copiedName, Encoding.UTF8);
            Assert.AreEqual(fileData, actualData);

            // make sure the original object still exists
            actualData = ReadAllObjectText(provider, containerName, objectName, Encoding.UTF8);
            Assert.AreEqual(fileData, actualData);

            // make sure the content type was not changed by the copy operation
            Assert.AreEqual(contentType, GetObjectContentType(provider, containerName, objectName));
            Assert.AreEqual(contentType, GetObjectContentType(provider, containerName, copiedName));

            /* Cleanup
             */
            provider.DeleteContainer(containerName, deleteObjects: true);
        }
开发者ID:nick-o,项目名称:openstack.net,代码行数:39,代码来源:UserObjectStorageTests.cs

示例7: Should_Copy_Object_When_Not_Passing_Content_Length

 public void Should_Copy_Object_When_Not_Passing_Content_Length()
 {
     var provider = new CloudFilesProvider();
     provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName, identity: _testIdentity);
 }
开发者ID:charlyraffellini,项目名称:openstack.net,代码行数:5,代码来源:CloudFilesTests.cs


注:本文中的net.openstack.Providers.Rackspace.CloudFilesProvider.CopyObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。