/// <exception cref="System.Exception"></exception> public virtual void Test3() { if (!isLocal) { return; } DeleteBase(OdbFileName1); DeleteBase(OdbFileName2); NeoDatis.Odb.OdbConfiguration.SetAutomaticallyIncreaseCacheSize(true); NeoDatis.Odb.ODB odb = Open(OdbFileName1); for (int i = 0; i < 15000; i++) { NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("olivier " + i, "[email protected] " + i, new NeoDatis.Odb.Test.VO.Login.Profile("profile" + i)); odb.Store(user); } odb.Close(); odb = Open(OdbFileName1); odb.DefragmentTo(Directory + OdbFileName2); NeoDatis.Odb.ODB newOdb = Open(OdbFileName2); AssertEquals(odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof( NeoDatis.Odb.Test.VO.Login.User))), newOdb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.User)))); odb.Close(); newOdb.Close(); DeleteBase(OdbFileName1); DeleteBase(OdbFileName2); }
/// <exception cref="System.Exception"></exception> public virtual void Test1() { if (!isLocal) { return; } DeleteBase(OdbFileName1); DeleteBase(OdbFileName2); NeoDatis.Odb.ODB odb = Open(OdbFileName1); NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("olivier" , "*****@*****.**", null); odb.Store(user); odb.Close(); odb = Open(OdbFileName1); odb.DefragmentTo(Directory + OdbFileName2); NeoDatis.Odb.ODB newOdb = Open(OdbFileName2); // int n = odb.getObjects(User.class).size(); // println("n="+n); System.Decimal nbUser = odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.User))); System.Decimal nbNewUser = newOdb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.User))); AssertEquals(nbUser, nbNewUser); AssertEquals(odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof( NeoDatis.Odb.Test.VO.Login.Profile))), newOdb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.Profile)))); odb.Close(); newOdb.Close(); DeleteBase(OdbFileName1); DeleteBase(OdbFileName2); }
/// <exception cref="System.Exception"></exception> public virtual void Test2() { if (!isLocal) { return; } DeleteBase(OdbFileName1); DeleteBase(OdbFileName2); NeoDatis.Odb.ODB odb = Open(OdbFileName1); NeoDatis.Odb.Test.VO.Login.Profile p = new NeoDatis.Odb.Test.VO.Login.Profile("profile" ); for (int i = 0; i < 500; i++) { NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("olivier " + i, "[email protected] " + i, p); odb.Store(user); } odb.Close(); odb = Open(OdbFileName1); odb.DefragmentTo(Directory + OdbFileName2); NeoDatis.Odb.ODB newOdb = Open(OdbFileName2); AssertEquals(odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof( NeoDatis.Odb.Test.VO.Login.User))), newOdb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.User)))); AssertEquals(odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof( NeoDatis.Odb.Test.VO.Login.Profile))), newOdb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.Profile)))); odb.Close(); newOdb.Close(); DeleteBase(OdbFileName1); DeleteBase(OdbFileName2); }
/// <exception cref="System.Exception"></exception> public virtual void Test3() { string baseName = GetBaseName(); string baseName2 = "2" + baseName; NeoDatis.Odb.ODB odb = Open(baseName); int size = 1000; for (int i = 0; i < size; i++) { odb.Store(new NeoDatis.Odb.Test.VO.Login.Function("function " + i)); } odb.Close(); odb = Open(baseName); NeoDatis.Odb.Objects objects = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function ), false); int j = 0; while (objects.HasNext() && j < objects.Count - 1) { odb.Delete(objects.Next()); j++; } odb.Close(); odb = Open(baseName); AssertEquals(1, odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.Function)))); odb.Close(); if (isLocal) { odb = Open(baseName); odb.DefragmentTo(NeoDatis.Odb.Test.ODBTest.Directory + baseName2); odb.Close(); odb = Open(baseName2); AssertEquals(1, odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.Function)))); odb.Close(); } DeleteBase(baseName); DeleteBase(baseName2); }