示例#1
0
 public override void SetUp()
 {
     RemoveDBFiles();
     MyPalStorage.ResourceCacheSize = 16;
     MyPalStorage.CreateDatabase();
     MyPalStorage.OpenDatabase();
     _storage = MyPalStorage.Storage;
 }
示例#2
0
文件: MyPalDBTests.cs 项目: mo5h/omeo
 protected void InitStorage()
 {
     RemoveDBFiles();
     MyPalStorage.ResourceCacheSize = 16;
     MyPalStorage.CreateDatabase();
     MyPalStorage.OpenDatabase();
     _storage = MyPalStorage.Storage;
     IndexConstructor.WorkDir = MyPalStorage.DBPath;
 }
示例#3
0
        [Test] public void StressTest()
        {
            for (int i = 0; i < 100; i++)
            {
                RemoveDBFiles();
                MyPalStorage.CreateDatabase();
                MyPalStorage.OpenDatabase();
                _storage = MyPalStorage.Storage;

                MyPalStorage.CloseDatabase();
                _storage = null;
                try
                {
                    RemoveDBFiles();
                }
                catch (Exception e)
                {
                    Console.WriteLine(" Error cleaning DB files: " + e.Message);
                }
            }
        }
示例#4
0
        public void Run()
        {
            _propTypes       = _db.GetTable("PropTypes");
            _resTypes        = _db.GetTable("ResourceTypes");
            _intProps        = _db.GetTable("IntProps");
            _stringProps     = _db.GetTable("StringProps");
            _longStringProps = _db.GetTable("LongStringProps");
            _stringListProps = _db.GetTable("StringListProps");
            _dateProps       = _db.GetTable("DateProps");
            _blobProps       = _db.GetTable("BlobProps");
            _doubleProps     = _db.GetTable("DoubleProps");
            _boolProps       = _db.GetTable("BoolProps");
            _resources       = _db.GetTable("Resources");
            _links           = _db.GetTable("Links");

            try
            {
                ShowProgress("Processing property types...");
                RepairPropTypes();
                ShowProgress("Processing resource types...");
                RepairResourceTypes();

                ShowProgress("Processing resources...");
                RepairResources();

                ShowProgress("Processing IntProps...");
                RepairProps(_intProps, PropDataType.Int);
                ShowProgress("Processing StringProps...");
                RepairProps(_stringProps, PropDataType.String);
                ShowProgress("Processing LongStringProps...");
                RepairProps(_longStringProps, PropDataType.LongString);
                ShowProgress("Processing DateProps...");
                RepairProps(_dateProps, PropDataType.Date);
                ShowProgress("Processing BlobProps...");
                RepairProps(_blobProps, PropDataType.Blob);
                ShowProgress("Processing DoubleProps...");
                RepairProps(_doubleProps, PropDataType.Double);
                ShowProgress("Processing StringListProps...");
                RepairProps(_stringListProps, PropDataType.StringList);
                ShowProgress("Processing BoolProps...");
                RepairProps(_boolProps, PropDataType.Bool);
                ShowProgress("Processing links...");
                RepairLinks();

                if (_fixErrors)
                {
                    ShowProgress("Repairing BlobFileSystem...");
                    _db.RepairBlobFileSystem();
                }
            }
            catch (Exception e)
            {
                ShowProgress("Fatal error during repair: " + e.Message);
                _repairException = e;
                _errorCount++;
            }

            ShowProgress("Closing database...");
            _db.Shutdown();

            if (_errorCount <= _fixCount)
            {
                MyPalStorage.OpenDatabase();
                try
                {
                    RepairRestrictions();

                    MyPalStorage.CloseDatabase();
                }
                catch (StorageException e)
                {
                    ShowProgress(e.ToString());
                }
                finally
                {
                    ShowProgress("done.");
                }
            }
            else
            {
                ShowProgress("Link restrictions were not checked because errors were found on earlier stages");
            }

            ShowProgress("Processed {0} resources, {1} properties and {2} links",
                         _resCount, _propCount, _linkCount);
            if (_errorCount == 0)
            {
                ShowProgress("No errors found");
            }
            else
            {
                ShowProgress("{0} errors found, {1} errors fixed", _errorCount, _fixCount);
            }
        }
示例#5
0
文件: MyPalDBTests.cs 项目: mo5h/omeo
 protected void ReopenStorage()
 {
     MyPalStorage.CloseDatabase();
     MyPalStorage.OpenDatabase();
     _storage = MyPalStorage.Storage;
 }