-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using NUnit.Framework;
-
-namespace Pithos.Network.Test
-{
- [TestFixture]
- class CloudFilesClientTest
- {
- [Test]
- public void TestPutHashMap()
- {
- var account = "890329@vho.grnet.gr";
- var apiKey = "24989dce4e0fcb072f8cb60c8922be19";
- var client = new CloudFilesClient(account, apiKey)
- {
- AuthenticationUrl = @"https://pithos.dev.grnet.gr",
- UsePithos = true
- };
- client.Authenticate();
- var fileName = @"vlc-1.1.11-win32.exe";
- var treeHash=Signature.CalculateTreeHashAsync(Path.Combine(@"e:\pithos\" ,fileName), 4*1024*1024 , "sha256", 2);
- var result = client.PutHashMap(account, "pithos", fileName, treeHash).Result;
-
- Assert.AreEqual(0,result.Count);
- }
-
- [Test]
- public void TestAuthentication()
- {
- var account = "ikons@cslab.ece.ntua.gr";
- var apiKey = "fKzKaRd7Uhov+xca4B4rOQ==";
- var client = new CloudFilesClient(account, apiKey)
- {
- AuthenticationUrl = @"https://plus.pithos.grnet.gr",
- UsePithos = true
- };
- var accountInfo=client.Authenticate();
- var containers=client.ListContainers(accountInfo.UserName);
- Assert.IsNotNull(containers);
- var result=client.GetAccountPolicies(accountInfo);
-
- Assert.IsNotNull(accountInfo);
- Assert.IsNotNull(result);
- }
-
-
- [Test]
- public void TestFolders()
- {
- var account = "pkanavos@gmail.com";
- var apiKey = "kAhnqSZwzzCMMjtPHkuFhw==";
-
- var client = new CloudFilesClient(account, apiKey)
- {
- AuthenticationUrl = @"https://pithos.dev.grnet.gr",
- UsePithos = true
- };
- var accountInfo = client.Authenticate();
- var containers = client.ListContainers(accountInfo.UserName);
- Assert.IsNotNull(containers);
- var result = client.GetAccountPolicies(accountInfo);
-
- Assert.IsNotNull(accountInfo);
- Assert.IsNotNull(result);
-
-
- var pithos=containers.First(c => c.Name == "pithos");
- var directories=client.ListObjects(account,"pithos","").Where(info=>info.IsDirectory);
- Assert.That(directories,!Is.Empty);
- Assert.IsTrue(directories.All(info=>info.IsDirectory));
- }
-
-
- [Test]
- public void TestBlockRange()
- {
- var account = "--";
- var apiKey = "--";
-
- var client = new CloudFilesClient(account, apiKey)
- {
- AuthenticationUrl = @"https://pithos.dev.grnet.gr",
- UsePithos = true
- };
-
- var blockSize = 4*1024*1024L;
-
- long endBlock = 512*blockSize;
- //ulong endBlokcL = 512*blockSize;
-
- Assert.That(endBlock,Is.GreaterThan(0));
-/*
- client.GetBlock(account,"Pithos",new Uri("somefile"),)
- //var accountInfo = client.Authenticate();
- var containers = client.ListContainers(accountInfo.UserName);
- */
- }
-
-
-
- }
-}
+using System;\r
+using System.Collections.Concurrent;\r
+using System.Collections.Generic;\r
+using System.IO;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading;\r
+using System.Threading.Tasks;\r
+using NUnit.Framework;\r
+\r
+namespace Pithos.Network.Test\r
+{\r
+ [TestFixture]\r
+ class CloudFilesClientTest\r
+ {\r
+ [Test]\r
+ public void TestPutHashMap()\r
+ {\r
+ var account = "890329@vho.grnet.gr";\r
+ var apiKey = "24989dce4e0fcb072f8cb60c8922be19";\r
+ var client = new CloudFilesClient(account, apiKey)\r
+ {\r
+ AuthenticationUrl = @"https://pithos.dev.grnet.gr", \r
+ UsePithos = true\r
+ };\r
+ client.Authenticate();\r
+ var fileName = @"vlc-1.1.11-win32.exe";\r
+ var treeHash = Signature.CalculateTreeHashAsync(Path.Combine(@"e:\pithos\", fileName), 4 * 1024 * 1024, "sha256", 2,CancellationToken.None, new Progress<double>());\r
+ var result = client.PutHashMap(account, "pithos".ToEscapedUri(), fileName.ToEscapedUri(), treeHash).Result;\r
+\r
+ Assert.AreEqual(0,result.Count);\r
+ }\r
+ \r
+ [Test]\r
+ public void TestAuthentication()\r
+ {\r
+ var account = "ikons@cslab.ece.ntua.gr";\r
+ var apiKey = "fKzKaRd7Uhov+xca4B4rOQ==";\r
+ var client = new CloudFilesClient(account, apiKey)\r
+ {\r
+ AuthenticationUrl = @"https://plus.pithos.grnet.gr", \r
+ UsePithos = true\r
+ };\r
+ var accountInfo=client.Authenticate();\r
+ var containers=client.ListContainers(accountInfo.UserName);\r
+ Assert.IsNotNull(containers);\r
+ var result=client.GetAccountPolicies(accountInfo);\r
+\r
+ Assert.IsNotNull(accountInfo);\r
+ Assert.IsNotNull(result);\r
+ }\r
+\r
+\r
+ [Test]\r
+ public void TestFolders()\r
+ {\r
+ var account = "pkanavos@gmail.com";\r
+ var apiKey = "kAhnqSZwzzCMMjtPHkuFhw==";\r
+\r
+ var client = new CloudFilesClient(account, apiKey)\r
+ {\r
+ AuthenticationUrl = @"https://pithos.dev.grnet.gr",\r
+ UsePithos = true\r
+ };\r
+ var accountInfo = client.Authenticate();\r
+ var containers = client.ListContainers(accountInfo.UserName);\r
+ Assert.IsNotNull(containers);\r
+ var result = client.GetAccountPolicies(accountInfo);\r
+\r
+ Assert.IsNotNull(accountInfo);\r
+ Assert.IsNotNull(result);\r
+\r
+\r
+ var pithos = containers.First(c => c.Name == "pithos".ToEscapedUri());\r
+ var directories = client.ListObjects(account, "pithos".ToEscapedUri(), "".ToEscapedUri()).Where(info => info.IsDirectory);\r
+ Assert.That(directories,!Is.Empty);\r
+ Assert.IsTrue(directories.All(info=>info.IsDirectory));\r
+ }\r
+\r
+\r
+ [Test]\r
+ public void TestBlockRange()\r
+ {\r
+ var account = "--";\r
+ var apiKey = "--";\r
+\r
+ var client = new CloudFilesClient(account, apiKey)\r
+ {\r
+ AuthenticationUrl = @"https://pithos.dev.grnet.gr",\r
+ UsePithos = true\r
+ };\r
+\r
+ var blockSize = 4*1024*1024L;\r
+\r
+ long endBlock = 512*blockSize;\r
+ //ulong endBlokcL = 512*blockSize;\r
+\r
+ Assert.That(endBlock,Is.GreaterThan(0));\r
+/*\r
+ client.GetBlock(account,"Pithos",new Uri("somefile"),)\r
+ //var accountInfo = client.Authenticate();\r
+ var containers = client.ListContainers(accountInfo.UserName);\r
+ */\r
+ }\r
+\r
+\r
+ \r
+ }\r
+}\r