本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}