diff --git a/src/console/console.csproj b/src/console/console.csproj index c04b66d53..52a814b1b 100644 --- a/src/console/console.csproj +++ b/src/console/console.csproj @@ -35,12 +35,13 @@ 4 - + + False ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll - + False - ..\packages\SimpleRESTServices.1.0.6.3\lib\net40\SimpleRESTServices.dll + ..\packages\SimpleRESTServices.1.0.6.6\lib\net40\SimpleRESTServices.dll diff --git a/src/console/packages.config b/src/console/packages.config index 06f77f62c..6566c6481 100644 --- a/src/console/packages.config +++ b/src/console/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/corelib/Core/Providers/IObjectStorageProvider.cs b/src/corelib/Core/Providers/IObjectStorageProvider.cs index 1246e2066..9d984d673 100644 --- a/src/corelib/Core/Providers/IObjectStorageProvider.cs +++ b/src/corelib/Core/Providers/IObjectStorageProvider.cs @@ -331,19 +331,33 @@ public interface IObjectStorageProvider /// Name of the source object.Example image_name.jpeg /// The destination container name. /// Name of the destination object.Example image_name.jpeg - /// The headers. + /// A list of HTTP headers to send to the service. /// The region in which to execute this action.If not specified, the user’s default region will be used. ///If set to true uses ServiceNet URL. /// The users Cloud Identity. If not specified, the default identity given in the constructor will be used. /// ObjectStore CopyObject(string sourceContainer, string sourceObjectName, string destinationContainer, string destinationObjectName, Dictionary headers = null, string region = null, bool useInternalUrl = false, CloudIdentity identity = null); + /// + /// Moves an object. The original source object will be deleted only if the move is successful. + /// + /// The source container name. + /// Name of the source object.Example image_name.jpeg + /// The destination container name. + /// Name of the destination object.Example image_name.jpeg + /// A list of HTTP headers to send to the service. + /// The region in which to execute this action.If not specified, the user’s default region will be used. + ///If set to true uses ServiceNet URL. + /// The users Cloud Identity. If not specified, the default identity given in the constructor will be used. + /// + ObjectStore MoveObject(string sourceContainer, string sourceObjectName, string destinationContainer, string destinationObjectName, Dictionary headers = null, string region = null, bool useInternalUrl = false, CloudIdentity identity = null); + /// /// Deletes the object. /// /// The container name. /// Name of the object.Example image_name.jpeg - /// The headers. + /// A list of HTTP headers to send to the service. /// The region in which to execute this action.If not specified, the user’s default region will be used. /// If set to true uses ServiceNet URL. /// The users Cloud Identity. If not specified, the default identity given in the constructor will be used. diff --git a/src/corelib/Providers/Rackspace/CloudFilesProvider.cs b/src/corelib/Providers/Rackspace/CloudFilesProvider.cs index 26085f492..cae34ace0 100644 --- a/src/corelib/Providers/Rackspace/CloudFilesProvider.cs +++ b/src/corelib/Providers/Rackspace/CloudFilesProvider.cs @@ -659,27 +659,13 @@ public ObjectStore CopyObject(string sourceContainer, string sourceObjectName, s _cloudFilesValidator.ValidateContainerName(destinationContainer); _cloudFilesValidator.ValidateObjectName(destinationObjectName); - if (headers != null) - { - if (string.IsNullOrWhiteSpace(headers.FirstOrDefault(x => x.Key.Equals(ContentLength, StringComparison.OrdinalIgnoreCase)).Value)) - { - var contentLength = GetObjectContentLength(identity, sourceContainer, sourceObjectName, region, useInternalUrl); - headers.Add(ContentLength, contentLength); - } - } - else - { - headers = new Dictionary(); - var contentLength = GetObjectContentLength(identity, sourceContainer, sourceObjectName, region, useInternalUrl); - headers.Add(ContentLength, contentLength); - - } - - headers.Add(CopyFrom, string.Format("{0}/{1}", sourceContainer, sourceObjectName)); + var urlPath = new Uri(string.Format("{0}/{1}/{2}", GetServiceEndpointCloudFiles(identity, region, useInternalUrl), _encodeDecodeProvider.UrlEncode(sourceContainer), _encodeDecodeProvider.UrlEncode(sourceObjectName))); - var urlPath = new Uri(string.Format("{0}/{1}/{2}", GetServiceEndpointCloudFiles(identity, region, useInternalUrl), _encodeDecodeProvider.UrlEncode(destinationContainer), _encodeDecodeProvider.UrlEncode(destinationObjectName))); + if(headers == null) + headers = new Dictionary(); - var response = ExecuteRESTRequest(identity, urlPath, HttpMethod.PUT, headers); + headers.Add(Destination, string.Format("{0}/{1}", destinationContainer, destinationObjectName)); + var response = ExecuteRESTRequest(identity, urlPath, HttpMethod.COPY, headers: headers); if (response.StatusCode == 201) return ObjectStore.ObjectCreated; @@ -697,7 +683,7 @@ public ObjectStore DeleteObject(string container, string objectName, Dictionary< var urlPath = new Uri(string.Format("{0}/{1}/{2}", GetServiceEndpointCloudFiles(identity, region, useInternalUrl), _encodeDecodeProvider.UrlEncode(container), _encodeDecodeProvider.UrlEncode(objectName))); - var response = ExecuteRESTRequest(identity, urlPath, HttpMethod.DELETE, headers); + var response = ExecuteRESTRequest(identity, urlPath, HttpMethod.DELETE, headers: headers); if (response.StatusCode == 204) return ObjectStore.ObjectDeleted; @@ -708,6 +694,17 @@ public ObjectStore DeleteObject(string container, string objectName, Dictionary< } + /// + public ObjectStore MoveObject(string sourceContainer, string sourceObjectName, string destinationContainer, string destinationObjectName, Dictionary headers = null, string region = null, bool useInternalUrl = false, CloudIdentity identity = null) + { + var result = CopyObject(sourceContainer, sourceObjectName, destinationContainer, destinationObjectName, headers, region, useInternalUrl, identity); + + if (result != ObjectStore.ObjectCreated) + return result; + + return DeleteObject(sourceContainer, sourceObjectName, headers, region, useInternalUrl, identity); + } + /// public ObjectStore PurgeObjectFromCDN(string container, string objectName, string region = null, CloudIdentity identity = null) { @@ -959,8 +956,9 @@ protected override IObjectStorageProvider BuildProvider(CloudIdentity identity) public const string Etag = "etag"; public const string ContentType = "content-type"; public const string ContentLength = "content-length"; - public const string CopyFrom = "x-copy-from"; + public const string Destination = "Destination"; public const string ObjectManifestMetadataKey = "x-object-manifest"; + //Cdn Object Constants public const string CdnPurgeEmail = "x-purge-email"; diff --git a/src/corelib/corelib.csproj b/src/corelib/corelib.csproj index a4b3a10bd..216bb4b78 100644 --- a/src/corelib/corelib.csproj +++ b/src/corelib/corelib.csproj @@ -35,11 +35,12 @@ + False ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll - + False - ..\packages\SimpleRESTServices.1.0.6.3\lib\net40\SimpleRESTServices.dll + ..\packages\SimpleRESTServices.1.0.6.6\lib\net40\SimpleRESTServices.dll @@ -215,7 +216,6 @@ - Always diff --git a/src/corelib/packages.config b/src/corelib/packages.config index 06f77f62c..6566c6481 100644 --- a/src/corelib/packages.config +++ b/src/corelib/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/openstack.net_Integration_Tests.sln b/src/openstack.net_Integration_Tests.sln index f7bb56571..0c3501c47 100644 --- a/src/openstack.net_Integration_Tests.sln +++ b/src/openstack.net_Integration_Tests.sln @@ -13,6 +13,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testing", "testing", "{62B45D81-B643-4E2B-B612-F479B9570F3A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "unit", "testing\unit\unit.csproj", "{FDFD92C2-75CF-4437-87B8-841EC3624CE4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console", "console\console.csproj", "{1C279666-B88A-4765-8A51-B352C85EFC28}" +EndProject Global GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = openstack.net.vsmdi @@ -46,11 +50,32 @@ Global {C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|Mixed Platforms.Build.0 = Release|Any CPU {C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|x86.ActiveCfg = Release|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Any CPU.Build.0 = Release|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|x86.ActiveCfg = Release|Any CPU + {1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Any CPU.ActiveCfg = Debug|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|x86.ActiveCfg = Debug|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|x86.Build.0 = Debug|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Any CPU.ActiveCfg = Release|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Mixed Platforms.Build.0 = Release|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Release|x86.ActiveCfg = Release|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4} = {62B45D81-B643-4E2B-B612-F479B9570F3A} + {FDFD92C2-75CF-4437-87B8-841EC3624CE4} = {62B45D81-B643-4E2B-B612-F479B9570F3A} EndGlobalSection EndGlobal diff --git a/src/openstack.net_Integration_Tests_2012.sln b/src/openstack.net_Integration_Tests_2012.sln index f7bb56571..a22db86e7 100644 --- a/src/openstack.net_Integration_Tests_2012.sln +++ b/src/openstack.net_Integration_Tests_2012.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "corelib", "corelib\corelib.csproj", "{7DBA11EB-DBA7-4D3A-8D42-B5312E74B9C0}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "integration", "testing\integration\integration.csproj", "{C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}" @@ -13,6 +13,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testing", "testing", "{62B45D81-B643-4E2B-B612-F479B9570F3A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "unit", "testing\unit\unit.csproj", "{FDFD92C2-75CF-4437-87B8-841EC3624CE4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console", "console\console.csproj", "{1C279666-B88A-4765-8A51-B352C85EFC28}" +EndProject Global GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = openstack.net.vsmdi @@ -46,11 +50,32 @@ Global {C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|Mixed Platforms.Build.0 = Release|Any CPU {C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|x86.ActiveCfg = Release|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Any CPU.Build.0 = Release|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|x86.ActiveCfg = Release|Any CPU + {1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Any CPU.ActiveCfg = Debug|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|x86.ActiveCfg = Debug|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|x86.Build.0 = Debug|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Any CPU.ActiveCfg = Release|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Mixed Platforms.Build.0 = Release|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Release|x86.ActiveCfg = Release|x86 + {1C279666-B88A-4765-8A51-B352C85EFC28}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4} = {62B45D81-B643-4E2B-B612-F479B9570F3A} + {FDFD92C2-75CF-4437-87B8-841EC3624CE4} = {62B45D81-B643-4E2B-B612-F479B9570F3A} EndGlobalSection EndGlobal diff --git a/src/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nuspec b/src/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nuspec index 5236069c1..bded369b6 100644 --- a/src/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nuspec +++ b/src/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nuspec @@ -1,5 +1,5 @@ - + Newtonsoft.Json 4.5.11 @@ -12,8 +12,5 @@ Json.NET is a popular high-performance JSON framework for .NET en-US json - - - \ No newline at end of file diff --git a/src/packages/SimpleRESTServices.1.0.6.3/lib/net40/SimpleRESTServices.dll b/src/packages/SimpleRESTServices.1.0.6.3/lib/net40/SimpleRESTServices.dll deleted file mode 100644 index ae84fc479..000000000 Binary files a/src/packages/SimpleRESTServices.1.0.6.3/lib/net40/SimpleRESTServices.dll and /dev/null differ diff --git a/src/packages/SimpleRESTServices.1.0.6.3/SimpleRESTServices.1.0.6.3.nuspec b/src/packages/SimpleRESTServices.1.0.6.6/SimpleRESTServices.1.0.6.6.nuspec similarity index 91% rename from src/packages/SimpleRESTServices.1.0.6.3/SimpleRESTServices.1.0.6.3.nuspec rename to src/packages/SimpleRESTServices.1.0.6.6/SimpleRESTServices.1.0.6.6.nuspec index ff7a7a9f8..56d3b1109 100644 --- a/src/packages/SimpleRESTServices.1.0.6.3/SimpleRESTServices.1.0.6.3.nuspec +++ b/src/packages/SimpleRESTServices.1.0.6.6/SimpleRESTServices.1.0.6.6.nuspec @@ -2,7 +2,7 @@ SimpleRESTServices - 1.0.6.3 + 1.0.6.6 SimpleRESTServices alanquillin alanquillin @@ -10,8 +10,9 @@ https://github.com/JSIStudios/SimpleRestServices true A simple set of client side and server side REST helpers - https://github.com/JSIStudios/SimpleRestServices/wiki/v1.0.6.3 + https://github.com/JSIStudios/SimpleRestServices/wiki/v1.0.6.6 Copyright 2013 + REST REST_client diff --git a/src/packages/SimpleRESTServices.1.0.6.6/lib/net40/SimpleRESTServices.dll b/src/packages/SimpleRESTServices.1.0.6.6/lib/net40/SimpleRESTServices.dll new file mode 100644 index 000000000..6069cdb7d Binary files /dev/null and b/src/packages/SimpleRESTServices.1.0.6.6/lib/net40/SimpleRESTServices.dll differ diff --git a/src/testing/integration/Providers/Rackspace/CloudFilesTests.cs b/src/testing/integration/Providers/Rackspace/CloudFilesTests.cs index eb9f4d5e5..b5e5b6817 100644 --- a/src/testing/integration/Providers/Rackspace/CloudFilesTests.cs +++ b/src/testing/integration/Providers/Rackspace/CloudFilesTests.cs @@ -24,7 +24,8 @@ public class CloudFilesTests const string webListingsCSS = "index.css"; const bool webListing = true; const string objectName = "DarkKnightRises.jpg"; - const string saveDirectory = @"C:\"; + const string saveFileNane1 = "DarkKnightRises_SAVE1.jpg"; + const string saveFileNane2 = "DarkKnightRises_SAVE2.jpg"; private static readonly string sourceContainerName = containerName; private const string sourceObjectName = objectName; @@ -65,6 +66,14 @@ public TestContext TestContext public static void Init(TestContext context) { _testIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestIdentity); + + var file = Path.Combine(Directory.GetCurrentDirectory(), saveFileNane1); + if(File.Exists(file)) + File.Delete(file); + + file = Path.Combine(Directory.GetCurrentDirectory(), saveFileNane2); + if (File.Exists(file)) + File.Delete(file); } #region Container Tests @@ -621,22 +630,16 @@ public void Should_Create_Object_From_File_Without_Headers() [DeploymentItem("DarkKnightRises.jpg")] public void Should_Get_Object_And_Save_To_File_Without_Headers() { - string filePath = Path.Combine(Directory.GetCurrentDirectory(), objectName); - string fileName = Path.GetFileName(filePath); - var headers = new Dictionary(); - var provider = new CloudFilesProvider(); - provider.GetObjectSaveToFile(containerName, saveDirectory, fileName, null, 65536, null, null, false, identity: _testIdentity); + var provider = new CloudFilesProvider(_testIdentity); + provider.GetObjectSaveToFile(containerName, Directory.GetCurrentDirectory(), objectName, saveFileNane1); } [TestMethod] [DeploymentItem("DarkKnightRises.jpg")] public void Should_Get_Object_And_Save_To_File_Without_Headers_And_Verify_Etag() { - string filePath = Path.Combine(Directory.GetCurrentDirectory(), objectName); - string fileName = Path.GetFileName(filePath); - var headers = new Dictionary(); - var provider = new CloudFilesProvider(); - provider.GetObjectSaveToFile(containerName, saveDirectory, fileName, null, 65536, null, null, true, identity: _testIdentity); + var provider = new CloudFilesProvider(_testIdentity); + provider.GetObjectSaveToFile(containerName, Directory.GetCurrentDirectory(), objectName, saveFileNane2, verifyEtag: true); } [TestMethod] @@ -684,29 +687,37 @@ public void Should_Copy_Object_When_Not_Passing_Content_Length() [TestMethod] public void Should_Copy_Object_When_Passing_Content_Length() { - Dictionary header = new Dictionary(); - header.Add(CloudFilesProvider.ContentLength, "62504"); - - var provider = new CloudFilesProvider(); - var copyResponse = provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName, header, identity: _testIdentity); + 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); } [TestMethod] 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; + var epoch = (int)(DateTime.UtcNow.AddDays(2) - new DateTime(1970, 1, 1)).TotalSeconds; - Dictionary header = new Dictionary(); - header.Add(CloudFilesProvider.ObjectDeleteAt, epoch.ToString()); + var header = new Dictionary { { CloudFilesProvider.ObjectDeleteAt, epoch.ToString() } }; - var provider = new CloudFilesProvider(); - var copyResponse = provider.CopyObject(sourceContainerName, sourceObjectName, destinationContainerName, destinationObjectName, header, identity: _testIdentity); + 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); + } [TestMethod] public void Should_Get_MetaData_For_Object1() diff --git a/src/testing/integration/integration.csproj b/src/testing/integration/integration.csproj index 7eb5f2ea5..5252715b2 100644 --- a/src/testing/integration/integration.csproj +++ b/src/testing/integration/integration.csproj @@ -37,16 +37,17 @@ ..\..\packages\Moq.4.0.10827\lib\NET40\Moq.dll - + + False ..\..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll False ..\..\packages\SSH.NET.2013.4.7\lib\net40\Renci.SshNet.dll - + False - ..\..\packages\SimpleRESTServices.1.0.6.3\lib\net40\SimpleRESTServices.dll + ..\..\packages\SimpleRESTServices.1.0.6.6\lib\net40\SimpleRESTServices.dll diff --git a/src/testing/integration/packages.config b/src/testing/integration/packages.config index 680b2a0b0..54a2997eb 100644 --- a/src/testing/integration/packages.config +++ b/src/testing/integration/packages.config @@ -2,6 +2,6 @@ - + \ No newline at end of file diff --git a/src/testing/unit/packages.config b/src/testing/unit/packages.config index 6933c1c5f..8183be47e 100644 --- a/src/testing/unit/packages.config +++ b/src/testing/unit/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/src/testing/unit/unit.csproj b/src/testing/unit/unit.csproj index 74f81bacf..fa20f8d3f 100644 --- a/src/testing/unit/unit.csproj +++ b/src/testing/unit/unit.csproj @@ -37,12 +37,13 @@ ..\..\packages\Moq.4.0.10827\lib\NET40\Moq.dll - + + False ..\..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll - + False - ..\..\packages\SimpleRESTServices.1.0.6.3\lib\net40\SimpleRESTServices.dll + ..\..\packages\SimpleRESTServices.1.0.6.6\lib\net40\SimpleRESTServices.dll