Exemplo n.º 1
0
        public void FileList()
        {
            var  accts     = _makeSvc();
            var  acct      = accts.accounts[0];
            bool haveCache = false;

            if (System.IO.File.Exists(@"c:\tmp\b2test\cache_sync.xml"))
            {
                haveCache = true;
                accts.filecache.load(@"c:\tmp\b2test\cache_sync.xml");
            }

            var conts = new BackupLib.commands.Containers {
                account = acct, cache = accts.filecache
            };

            conts.run();

            var cont = accts.filecache.containers[0];

            var cr = new BackupLib.commands.FileList
            {
                account = acct, cache = accts.filecache, container = cont, useRemote = !haveCache
            };
            var res = cr.run();

            Assert.IsNotNull(res);
            Assert.IsTrue(res.Count > 0, "Maybe run a sync first?");

            accts.filecache.save(@"c:\tmp\b2test\cache_sync.xml");
        }
Exemplo n.º 2
0
        public void FileList()
        {
            var  accts     = _makeSvc();
            var  acct      = accts.accounts[0];
            bool haveCache = false;

            var conts = new BackupLib.commands.Containers {
                account = acct, cache = accts.filecache
            };

            conts.run();

            var cont = accts.filecache.containers[0];

            var cr = new BackupLib.commands.FileList
            {
                account = acct, cache = accts.filecache, container = cont, useRemote = !haveCache
            };
            var res = cr.run();

            Assert.That(res, Is.Not.Null);
            Assert.That(res, Is.Not.Empty, "Maybe run a sync first?");

            //accts.filecache.save(@"c:\tmp\b2test\cache_sync.xml");
        }
Exemplo n.º 3
0
        public void CmdContainerList()
        {
            var acct  = _getAcct();
            var conts = new BackupLib.commands.Containers {
                account = acct, cache = acct.service.fileCache
            };

            conts.run();
            Assert.IsNotNull(acct.service.fileCache.containers);
            Assert.IsTrue(acct.service.fileCache.containers.Where(x => x.accountID == acct.id).Any());
        }
Exemplo n.º 4
0
        public void ContainersTest()
        {
            var accts = _makeSvc();
            var acct  = accts.accounts[0];

            var conts = new BackupLib.commands.Containers {
                account = acct, cache = accts.filecache
            };

            conts.run();

            Assert.That(accts.filecache.containers, Is.Not.Null);
            Assert.That(accts.filecache.containers, Is.Not.Empty);
        }
Exemplo n.º 5
0
        public void ContainersTest()
        {
            var accts = _makeSvc();
            var acct  = accts.accounts[0];

            var conts = new BackupLib.commands.Containers {
                account = acct, cache = accts.filecache
            };

            conts.run();

            Assert.IsNotNull(accts.filecache.containers);
            Assert.IsTrue(accts.filecache.containers.Count > 0);
        }
Exemplo n.º 6
0
        public override int run(BUCommon.AccountList accounts)
        {
            var acct  = _getAcct(accounts, _acct);
            var conts = new BackupLib.commands.Containers {
                account = acct, cache = accounts.filecache
            };

            conts.run();

            var cs = accounts.filecache.getContainers(acct.id);

            Console.WriteLine("Account: {0}", acct.name);
            foreach (var c in cs)
            {
                Console.WriteLine("{0} - {1}", c.name, c.type);
            }

            return(0);
        }
Exemplo n.º 7
0
        public void Sync()
        {
            var accts = _makeSvc();
            var acct  = accts.accounts[0];

            var conts = new BackupLib.commands.Containers {
                account = acct, cache = accts.filecache
            };

            conts.run();

            var cont = accts.filecache.containers[0];

            var cr = new BackupLib.commands.Sync
            {
                account   = acct, cache = accts.filecache, container = cont
                , keyFile = @"C:\tmp\id_rsa_1_pub", pathRoot = @"C:\tmp\photos"
            };

            cr.run();

            accts.filecache.save(@"c:\tmp\b2test\cache_sync.xml");
        }
Exemplo n.º 8
0
        public void CopyRemote()
        {
            var accts = _makeSvc();
            var acct  = accts.accounts[0];

            var conts = new BackupLib.commands.Containers {
                account = acct, cache = accts.filecache
            };

            conts.run();

            var cont = accts.filecache.containers[0];

            var cr = new BackupLib.commands.CopyRemote
            {
                account     = acct
                , cache     = accts.filecache
                , container = cont
                , pathRoot  = @"c:\tmp\photos"
                , key       = @"c:\tmp\id_rsa_1_pub"
            };

            cr.run();
        }
Exemplo n.º 9
0
        public void CopyLocal()
        {
            var accts = _makeSvc();
            var acct  = accts.accounts[0];

            var conts = new BackupLib.commands.Containers {
                account = acct, cache = accts.filecache
            };

            conts.run();

            BUCommon.FreezeFile rmt = null;

            var cont = accts.filecache.containers[0];

            if (cont.files.Count > 0)
            {
                rmt = cont.files[0];
            }

            Assert.That(rmt, Is.Not.Null);
            Assert.That(rmt.fileID, Is.Not.Null);

            var cl = new BackupLib.commands.CopyLocal
            {
                account    = acct
                , cont     = cont
                , noAction = true
                , filterre = rmt.path
                , key      = @"c:\tmp\id_rsa_1"
                , destPath = @"c:\tmp\photos1"
            };

            System.IO.Directory.CreateDirectory(cl.destPath);
            cl.run();
        }