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);
        }
Example #2
0
        public void Should_Copy_Object_When_Passing_Content_Length()
        {
            var provider = new CloudFilesProvider(_testIdentity);

            provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName);

            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);
        }
Example #3
0
        public void Should_Copy_Object_When_Not_Passing_Content_Length_And_Passing_Expiring_Header()
        {
            // Object will expire 2 days from now.
            var epoch = (int)(DateTimeOffset.UtcNow.AddDays(2) - new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero)).TotalSeconds;

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

            var provider = new CloudFilesProvider(_testIdentity);

            provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName, null, header);

            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);
        }
Example #4
0
        public void Should_Copy_Object_When_Not_Passing_Content_Length()
        {
            var provider = new CloudFilesProvider();

            provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName, identity: _testIdentity);
        }
Example #5
0
 public string Copy(string objectName, GxFileType sourceFileType, string newName, GxFileType targetFileType)
 {
     openstackFilesProvider.CopyObject(GetBucket(sourceFileType), objectName, GetBucket(targetFileType), newName);
     return(GetURL(newName, targetFileType));
 }