Example #1
0
        public static void LoadFromTest()
        {
            var cm = new ChunkManager.ChunkManager();
            DataBase.Create( "nunit_db_loadfrom", cm );

            var db = DataBase.LoadFrom( "nunit_db_loadfrom", cm );

            Assert.IsNotNull(db, "Can't load DB from a filesystem!");
        }
Example #2
0
 public static void Drop()
 {
     var cm = new ChunkManager.ChunkManager();
     var db  = DataBase.Create( "nunit_db_drop", cm );
     User.User user = User.User.New("root", "12345678");
     db.AddAccess( user, AccessFunctions.Access.AccessLevel.ADMIN );
     db.Drop(user);
     Assert.AreEqual( 0, db.MemStorage.Count );
     Assert.IsFalse( System.IO.Directory.Exists(db.DbPath));
 }
Example #3
0
        protected DataBase(string db_name, ChunkManager.ChunkManager _cm, bool is_new_db)
        {
            local_am = new DSAccessManager(this);
            MemStorage = new DwarfDB.Stack.DataStorage(this);

            if (_cm != null)
                chunk_manager = _cm;
            else {
                chunk_manager = new DwarfDB.ChunkManager.ChunkManager();
            }
            Name = db_name;
            chunk_manager.Load(Name, is_new_db);
        }
Example #4
0
        public static void CreateRecord( string db_name, string container_name )
        {
            UnitTests.DataBaseTest.Create();
            UnitTests.DataBaseTest.CreateContainer();

            var user = User.User.New( "root", "12345678");
            var cm = new ChunkManager.ChunkManager();
            var db = DataBase.LoadFrom( db_name, cm );
            var dc = db.GetDataContainer( container_name, user );

            // Creating a new record
            var rec = new Record(dc);
            rec["col1"].Value = "AAABBBCCC";
            rec["col2"].Value = 20.390494;
            rec.BuildIndex();
            dc.AddRecordToDataStorage(rec);

            dc.Save();

            Assert.IsTrue( dc.GetRecordsInternal().Count >= 1 );
        }
Example #5
0
 public static void Create()
 {
     var cm = new ChunkManager.ChunkManager();
     var db  = DataBase.Create( "nunit_db", cm );
     Assert.AreEqual( true, DataBase.Exists( db.Name ));
 }