Exemplo n.º 1
0
 public void hashCodeComparerStringTest()
 {
   Oid id;
   using (SessionNoServer session = new SessionNoServer(systemDir))
   {
     Placement place = new Placement(223, 1, 1, UInt16.MaxValue, UInt16.MaxValue);
     session.Compact();
     session.BeginUpdate();
     HashCodeComparer<string> hashCodeComparer = new HashCodeComparer<string>();
     BTreeSet<string> bTree = new BTreeSet<string>(hashCodeComparer, session);
     bTree.Persist(place, session);
     id = bTree.Oid;
     for (int i = 0; i < 100000; i++)
     {
       bTree.Add(i.ToString());
     }
     session.Commit();
   }
   using (SessionNoServer session = new SessionNoServer(systemDir))
   {
     session.BeginRead();
     BTreeSet<string> bTree= (BTreeSet<string>)session.Open(id);
     int count = 0;
     foreach (string str in bTree)
     {
       count++;
     }
     Assert.True(100000 == count);
     session.Commit();
   }
 }
Exemplo n.º 2
0
        public void hashCodeComparerStringTest()
        {
            Oid id;

            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                Placement place = new Placement(223, 1, 1, UInt16.MaxValue, UInt16.MaxValue);
                session.Compact();
                session.BeginUpdate();
                HashCodeComparer <string> hashCodeComparer = new HashCodeComparer <string>();
                BTreeSet <string>         bTree            = new BTreeSet <string>(hashCodeComparer, session);
                bTree.Persist(place, session);
                id = bTree.Oid;
                for (int i = 0; i < 100000; i++)
                {
                    bTree.Add(i.ToString());
                }
                session.Commit();
            }
            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginRead();
                BTreeSet <string> bTree = (BTreeSet <string>)session.Open(id);
                int count = 0;
                foreach (string str in bTree)
                {
                    count++;
                }
                Assert.True(100000 == count);
                session.Commit();
            }
        }
Exemplo n.º 3
0
 public void CsvExport()
 {
     using (SessionNoServer session = new SessionNoServer(systemDir))
     {
         session.Compact();
         session.BeginRead();
         session.ExportToCSV(csvExportDir);
         session.Commit();
     }
 }
Exemplo n.º 4
0
 public void CsvExport()
 {
   using (SessionNoServer session = new SessionNoServer(systemDir))
   {
     session.Compact();
     session.BeginRead();
     session.ExportToCSV(csvExportDir);
     session.Commit();
   }
 }
Exemplo n.º 5
0
        public void SimpleObject0()
        {
            UInt64 id;

            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginUpdate();
                var rec = new TestRecord();
                rec.Persist(session, rec);
                id = rec.Id;
                session.Commit();
                session.Compact();
            }

            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginRead();
                TestRecord tr2 = (TestRecord)session.Open(id);
                session.Commit();
            }
        }
Exemplo n.º 6
0
        public void aCreateDefaultCompareIntKeyIntValue(int number)
        {
            Oid id;

            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                Placement place = new Placement((UInt32)number, 1, 1, UInt16.MaxValue, UInt16.MaxValue);
                session.Compact();
                session.BeginUpdate();
                BTreeMap <int, int> bTree = new BTreeMap <int, int>(null, session);
                bTree.Persist(place, session);
                id = bTree.Oid;
                for (int i = 0; i < number; i++)
                {
                    bTree.Add(i, i + 1);
                }
                bTree.Clear();
                for (int i = 0; i < number; i++)
                {
                    bTree.Add(i, i + 1);
                }
                session.Commit();
            }
            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginRead();
                BTreeMap <int, int> bTree = (BTreeMap <int, int>)session.Open(id);
                int count = 0;
                int prior = 0;
                foreach (KeyValuePair <int, int> pair in bTree)
                {
                    count++;
                    Assert.True(pair.Key == prior++);
                    Assert.True(pair.Key == pair.Value - 1);
                }
                Assert.True(number == count);
                session.Commit();
            }
        }
Exemplo n.º 7
0
        public void FixedSizeTest()
        {
            UInt64 id;

            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginUpdate();
                FixedSize fixedSize = new FixedSize();
                fixedSize.Persist(session, fixedSize);
                id = fixedSize.Id;
                session.Commit();
                session.Compact();
            }
            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginRead();
                FixedSize fixedSize = (FixedSize)session.Open(id);
                Assert.NotNull(fixedSize);
                session.Commit();
                session.Compact();
            }
        }
Exemplo n.º 8
0
 public void aCreateDefaultCompareIntKeyIntValue(int number)
 {
   Oid id;
   using (SessionNoServer session = new SessionNoServer(systemDir))
   {
     Placement place = new Placement((UInt32)number, 1, 1, UInt16.MaxValue, UInt16.MaxValue);
     session.Compact();
     session.BeginUpdate();
     BTreeMap<int, int> bTree = new BTreeMap<int, int>(null, session);
     bTree.Persist(place, session);
     id = bTree.Oid;
     for (int i = 0; i < number; i++)
     {
       bTree.Add(i, i + 1);
     }
     bTree.Clear();
     for (int i = 0; i < number; i++)
     {
       bTree.Add(i, i + 1);
     }
     session.Commit();
   }
   using (SessionNoServer session = new SessionNoServer(systemDir))
   {
     session.BeginRead();
     BTreeMap<int, int> bTree = (BTreeMap<int, int>)session.Open(id);
     int count = 0;
     int prior = 0;
     foreach (KeyValuePair<int, int> pair in bTree)
     {
       count++;
       Assert.True(pair.Key == prior++);
       Assert.True(pair.Key == pair.Value - 1);
     }
     Assert.True(number == count);
     session.Commit();
   }
 }