public CreateFileRequest(CloudApi cloudApi, string fullPath, string hash, long size, ConflictResolver?conflictResolver) : base(cloudApi)
 {
     _fullPath         = fullPath;
     _hash             = hash;
     _size             = size;
     _conflictResolver = conflictResolver ?? ConflictResolver.Rename;
 }
示例#2
0
        public void UpdateDataTest()
        {
            CloudUpdateData data = new CloudUpdateData()
            {
                Data = new CloudData()
                {
                    Title    = "地点名称" + Guid.NewGuid().ToString(),
                    Address  = "太原理工大学" + Guid.NewGuid().ToString(),
                    Location = new Location()
                    {
                        Lat = 39.983988m, Lng = 116.307709m
                    },
                    Tel = "0351-2506888"
                },
                TableId = tableId,
                Key     = key,
                Filter  = "ud_id in(\"3d5a53fe-1a2e-4511-b948-88b48fb0114b\")"
            };

            var response = CloudApi.UpdateData(data, key, secretKey);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.Status, successStatus);
            Assert.IsNotNull(response.Result);
            Assert.AreEqual(response.Result.Count, 1);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
示例#3
0
        public void SearchPageData()
        {
            var response = CloudApi.Search(tableId, key, secretKey, page_index: 1, orderby: "id desc");

            Assert.IsTrue(response.IsSuccess);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
示例#4
0
 public FolderInfoRequest(CloudApi cloudApi, string path, bool isWebLink = false, int offset = 0, int limit = int.MaxValue) : base(cloudApi)
 {
     _path      = path;
     _isWebLink = isWebLink;
     _offset    = offset;
     _limit     = limit;
 }
示例#5
0
        public void SearchNeayByTest()
        {
            string location = "40.0836811,116.1798274";//39.976194,116.317987
            var    response = CloudApi.SearchNearby(tableId, key, secretKey, location, radius: 10000, auto_extend: 1);

            Assert.IsTrue(response.IsSuccess);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
示例#6
0
        public void SearchRegionTest()
        {
            const string regions  = "北京市,海淀区";
            var          response = CloudApi.SearchRegion(tableId, key, secretKey, regions);

            Assert.IsTrue(response.IsSuccess);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
示例#7
0
        public void SearchRectangle()
        {
            const string reactangle = "39.4248013,115.7022707;40.9571659,117.0102863";
            var          response   = CloudApi.SearchRectangle(tableId, key, secretKey, reactangle, fields: "title,x");

            Assert.IsTrue(response.IsSuccess);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
示例#8
0
        public void SearchContain()
        {
            const string location = "39.4248013,115.7022707;";
            var          response = CloudApi.SearchContain(tableId, key, secretKey, location);

            Assert.IsTrue(response.IsSuccess);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
示例#9
0
        public void QueryStructureTest()
        {
            var response = CloudApi.QueryStructure(tableId, key, secretKey);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.Status, 0);
            Assert.IsNotNull(response.Result);
            Assert.IsNotNull(response.Result.Tables);
            Assert.IsTrue(response.Result.Tables.Count > 0);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MailRuCloud" /> class.
        /// </summary>
        /// <param name="login">Login name as the email.</param>
        /// <param name="password">Password, associated with this email.</param>
        /// <param name="twoFaHandler"></param>
        public MailRuCloud(string login, string password, ITwoFaHandler twoFaHandler)
        {
            CloudApi = new CloudApi(login, password, twoFaHandler);

            //TODO: wow very dummy linking, refact cache realization globally!
            _itemCache = new StoreItemCache(TimeSpan.FromSeconds(60))
            {
                CleanUpPeriod = TimeSpan.FromMinutes(5)
            };
            _linkManager = new LinkManager(this);
        }
示例#11
0
        public LoginWindow()
        {
            InitializeComponent();
            DataContext = this;

            CloudApi.Initialize("http://localhost:9091/cloudapi/");

            //Debug
            MyUsername = "******";
            MyPassword = new SecureString();
            "ctrl".ToCharArray().ToList().ForEach(p => MyPassword.AppendChar(p));
            PerformLogin();
        }
示例#12
0
        public void CreateDataTest()
        {
            const int latMin = 389839880;
            const int latMax = 404887374;
            const int lngMin = 1155541990;
            const int lngMax = 1170812988;

            decimal         lat  = random.Next(latMin, latMax) / 10000000m;
            decimal         lng  = random.Next(lngMin, lngMax) / 10000000m;
            CloudCreateData data = new CloudCreateData()
            {
                Key     = key,
                TableId = tableId,
                Data    = new List <CloudData>()
                {
                    new CloudData()
                    {
                        UdId     = Guid.NewGuid().ToString(),
                        Title    = "地点名称" + Guid.NewGuid().ToString(),
                        Address  = "太原理工大学" + Guid.NewGuid().ToString(),
                        Location = new Location()
                        {
                            Lat = lat, Lng = lng
                        },
                        Tel = "0351-2506887"
                    }
                }
            };
            //模拟成功的示例
            var response = CloudApi.CreateData(data, key, secretKey);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.Status, successStatus);
            Assert.AreEqual(response.Result.Count, 1);
            Assert.IsNotNull(response.Result.Success);
            Assert.IsNotNull(response.Result.Success[0].Id);
            Assert.IsNotNull(response.Result.Success[0].UdId);
            Assert.AreEqual(response.Result.Success[0].RowIdx, 0);
            //模拟失败的示例
            data.Data[0].Title = null;
            response           = CloudApi.CreateData(data, key, secretKey);
            Assert.IsNotNull(response);
            Assert.AreEqual(response.Status, successStatus);
            Assert.AreEqual(response.Result.Count, 0);
            Assert.IsNotNull(response.Result.Failure);
            Assert.AreNotEqual(response.Result.Failure[0].Status, successStatus);
            Assert.IsNotNull(response.Result.Failure[0].UdId);
            Assert.IsNotNull(response.Result.Failure[0].RowIdx);
            Assert.IsNotNull(response.Result.Failure[0].Message);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
示例#13
0
        public void DeleteDataTest()
        {
            CloudDeleteData data = new CloudDeleteData()
            {
                Key     = key,
                TableId = tableId,
                Filter  = "ud_id in(\"0c24030d-d564-49c7-adef-47217c726456\")"
            };
            var response = CloudApi.DeleteData(data, key, secretKey);

            Assert.IsNotNull(response);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
            //Assert.AreEqual(response.Status, successStatus);
            //Assert.AreEqual(response.Result.Count, 1);
        }
示例#14
0
        public static void Main(string[] args)
        {
            CloudApi.Initialize("http://localhost:9091/cloudapi/", "SERVER");

            Console.WriteLine("CloudApiHost (b/{0})", CAHostConfig.CLOUD_API_HOST_BUILD);
            Console.WriteLine("===========================");
            CAMongoManager.Instance.Connect();

            Console.WriteLine("New assembly has been deployed!");
            CAAssemblyLoader.LoadFromFile(CAHostConfig.CLOUD_API_ASSEMBLY_PATH + CAHostConfig.CLOUD_API_ASSEMBLY_NAME);

            CAHttpServer.Instance.Begin();
            Console.WriteLine("===========================");
            Console.ReadKey();
        }
 public CloneItemRequest(CloudApi cloudApi, string fromUrl, string toPath) : base(cloudApi)
 {
     _fromUrl = fromUrl;
     _toPath  = toPath;
 }
示例#16
0
 public DownloadTokenHtmlRequest(CloudApi cloudApi, string url) : base(cloudApi)
 {
     _url = url;
 }
示例#17
0
 public DownloadTokenRequest(CloudApi cloudApi) : base(cloudApi)
 {
 }
示例#18
0
 public SecondStepAuthRequest(CloudApi cloudApi, string csrf, string login, string authCode) : base(cloudApi)
 {
     _csrf     = csrf;
     _login    = login;
     _authCode = authCode;
 }
示例#19
0
 public ShardInfoRequest(CloudApi cloudApi) : base(cloudApi)
 {
 }
 public AuthTokenRequest(CloudApi cloudApi) : base(cloudApi)
 {
 }
示例#21
0
 protected BaseRequest(CloudApi cloudApi)
 {
     CloudApi = cloudApi;
 }
示例#22
0
 public LoginRequest(CloudApi cloudApi, string login, string password) : base(cloudApi)
 {
     _login    = login;
     _password = password;
 }
示例#23
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cloudApi"></param>
 /// <param name="sourceFullPath"></param>
 /// <param name="destinationPath">(without item name)</param>
 /// <param name="conflictResolver"></param>
 public CopyRequest(CloudApi cloudApi, string sourceFullPath, string destinationPath, ConflictResolver?conflictResolver = null) : base(cloudApi)
 {
     _sourceFullPath   = sourceFullPath;
     _destinationPath  = destinationPath;
     _conflictResolver = conflictResolver ?? ConflictResolver.Rename;
 }
 public EnsureSdcCookieRequest(CloudApi cloudApi) : base(cloudApi)
 {
 }
 public AccountInfoRequest(CloudApi cloudApi) : base(cloudApi)
 {
 }
 public RenameRequest(CloudApi cloudApi, string fullPath, string newName) : base(cloudApi)
 {
     _fullPath = fullPath;
     _newName  = newName;
 }
示例#27
0
 public TestAssemblyClass()
 {
     CloudApi.RegisterObjectType <TestObject>();
     CloudApi.RegisterObjectType <NestedObject>();
 }
 public CreateFolderRequest(CloudApi cloudApi, string fullPath) : base(cloudApi)
 {
     _fullPath = fullPath;
 }
示例#29
0
 public MoveOrCopyRequest(CloudApi cloudApi, string sourceFullPath, string destinationPath, bool move) : base(cloudApi)
 {
     _sourceFullPath  = sourceFullPath;
     _destinationPath = destinationPath;
     _move            = move;
 }
 public RemoveRequest(CloudApi cloudApi, string fullPath) : base(cloudApi)
 {
     _fullPath = fullPath;
 }