public virtual void Test1WithoutCommit() { if (!runAll) { return; } NeoDatis.Tool.StopWatch stopWatch = new NeoDatis.Tool.StopWatch(); stopWatch.Start(); int size = 10000; int size2 = 5000; int nbFunctions = 10; DeleteBase(FileName); NeoDatis.Odb.ODB odb = Open(FileName); Function f1 = new Function( "function 1"); // Create Objects for (int i = 0; i < size; i++) { NeoDatis.Odb.Test.VO.Login.Profile p = new NeoDatis.Odb.Test.VO.Login.Profile("profile number " + i, f1); for (int j = 0; j < nbFunctions; j++) { p.AddFunction(new Function(" inner function of profile : number " + i + " - " + j)); } User user = new User("user name " + i, "user email " + i, p); odb.Store(user); } Println("created"); // Updates 10 times the objects NeoDatis.Odb.Objects <User> objects = odb.GetObjects <User>(); for (int k = 0; k < 10; k++) { objects.Reset(); for (int i = 0; i < size2; i++) { User user = (User)objects.Next (); user.GetProfile().SetName(user.GetProfile().GetName() + "-updated"); odb.Store(user); } } Println("updated"); // Delete the rest of the objects for (int i = size2; i < size; i++) { odb.Delete(objects.Next()); } Println("deleted"); // Check object count objects = odb.GetObjects <User>(); AssertEquals(size2, objects.Count); // Check data of the objects int a = 0; while (objects.HasNext()) { User user = (User)objects.Next (); AssertEquals("user name " + a, user.GetName()); AssertEquals("user email " + a, user.GetEmail()); AssertEquals("profile number " + a + "-updated-updated-updated-updated-updated-updated-updated-updated-updated-updated" , user.GetProfile().GetName()); a++; } Println("checked"); for (int k = 0; k < 10; k++) { objects.Reset(); for (int i = 0; i < size2; i++) { User user = (User)objects.Next (); user.GetProfile().SetName(user.GetProfile().GetName() + "-updated" + "-"); odb.Store(user); } } Println("re-updated"); objects = odb.GetObjects <User>(); NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.Dummy .GetEngine(odb); NeoDatis.Odb.Core.Layers.Layer2.Meta.CIZoneInfo uncommited = engine.GetSession(true ).GetMetaModel().GetClassInfo(typeof(User).FullName, true).GetUncommittedZoneInfo(); NeoDatis.Odb.Core.Layers.Layer2.Meta.CIZoneInfo commited = engine.GetSession(true ).GetMetaModel().GetClassInfo(typeof(User).FullName, true).GetCommitedZoneInfo(); Println("Before commit : uncommited=" + uncommited); Println("Before commit : commited=" + commited); a = 0; while (objects.HasNext()) { // println("a="+a); odb.Delete(objects.Next()); a++; } AssertEquals(size2, a); AssertEquals(0, odb.GetObjects <User>().Count); AssertEquals(0, odb.Count(new CriteriaQuery(typeof(User)))); Println("deleted"); odb.Close(); stopWatch.End(); Println("Total time 2 = " + stopWatch.GetDurationInMiliseconds()); if (stopWatch.GetDurationInMiliseconds() > 108438) { Fail("time is > than " + 108438 + " = " + stopWatch.GetDurationInMiliseconds()); } }
public virtual void Set(NeoDatis.Odb.Core.Layers.Layer2.Meta.CIZoneInfo zoneInfo) { this.nbObjects = zoneInfo.nbObjects; this.first = zoneInfo.first; this.last = zoneInfo.last; }