/// <exception cref="System.Exception"></exception> public virtual void Test1() { DeleteBase("t1.neodatis"); // LogUtil.allOn(true); NeoDatis.Odb.ODB odb = Open("t1.neodatis"); // LogUtil.objectWriterOn(true); NeoDatis.Odb.Test.VO.Login.Function login = new NeoDatis.Odb.Test.VO.Login.Function ("login"); System.Collections.IList list = new System.Collections.ArrayList(); list.Add(login); NeoDatis.Odb.Test.VO.Login.Profile profile1 = new NeoDatis.Odb.Test.VO.Login.Profile ("operator 1", list); NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("olivier smadja" , "*****@*****.**", profile1); odb.Store(user); odb.Close(); odb = Open("t1.neodatis"); NeoDatis.Odb.Objects users = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User ), true); // assertEquals(nbUsers+2,users.size()); NeoDatis.Odb.Test.VO.Login.User user2 = (NeoDatis.Odb.Test.VO.Login.User)users.GetFirst (); odb.Close(); AssertEquals(user.ToString(), user2.ToString()); DeleteBase("t1.neodatis"); }
/// <exception cref="System.Exception"></exception> public virtual void TestCompositeCollection2DifferentObjects() { DeleteBase("ti1.neodatis"); NeoDatis.Odb.ODB odb = Open("ti1.neodatis"); int nbUsers = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User), true).Count; int nbProfiles = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Profile), true) .Count; int nbFunctions = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function), true ).Count; NeoDatis.Odb.Test.VO.Login.Function login = new NeoDatis.Odb.Test.VO.Login.Function ("login"); NeoDatis.Odb.Test.VO.Login.Function logout = new NeoDatis.Odb.Test.VO.Login.Function ("logout"); NeoDatis.Odb.Test.VO.Login.Function disconnect = new NeoDatis.Odb.Test.VO.Login.Function ("disconnect"); System.Collections.IList list = new System.Collections.ArrayList(); list.Add(login); list.Add(logout); System.Collections.IList list2 = new System.Collections.ArrayList(); list.Add(login); list.Add(logout); NeoDatis.Odb.Test.VO.Login.Profile profile1 = new NeoDatis.Odb.Test.VO.Login.Profile ("operator 1", list); NeoDatis.Odb.Test.VO.Login.Profile profile2 = new NeoDatis.Odb.Test.VO.Login.Profile ("operator 2", list2); NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("olivier smadja" , "*****@*****.**", profile1); NeoDatis.Odb.Test.VO.Login.User userB = new NeoDatis.Odb.Test.VO.Login.User("A√°sa Galv√£o Smadja" , "*****@*****.**", profile2); odb.Store(user); odb.Store(userB); odb.Commit(); NeoDatis.Odb.Objects functions = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function ), true); NeoDatis.Odb.Objects profiles = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Profile ), true); NeoDatis.Odb.Objects users = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User ), true); odb.Close(); // assertEquals(nbUsers+2,users.size()); NeoDatis.Odb.Test.VO.Login.User user2 = (NeoDatis.Odb.Test.VO.Login.User)users.GetFirst (); AssertEquals(user.ToString(), user2.ToString()); AssertEquals(nbProfiles + 2, profiles.Count); AssertEquals(nbFunctions + 2, functions.Count); DeleteBase("ti1.neodatis"); }
/// <exception cref="System.Exception"></exception> public virtual void TestCompositeCollection3() { DeleteBase("t4.neodatis"); NeoDatis.Odb.ODB odb = Open("t4.neodatis"); // Configuration.addLogId("ObjectWriter"); // Configuration.addLogId("ObjectReader"); // Configuration.addLogId("FileSystemInterface"); int nbUsers = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User), true).Count; int nbProfiles = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Profile), true) .Count; int nbFunctions = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function), true ).Count; NeoDatis.Odb.Test.VO.Login.Function login = new NeoDatis.Odb.Test.VO.Login.Function ("login"); NeoDatis.Odb.Test.VO.Login.Function logout = new NeoDatis.Odb.Test.VO.Login.Function ("logout"); System.Collections.IList list = new System.Collections.ArrayList(); list.Add(login); list.Add(logout); NeoDatis.Odb.Test.VO.Login.Profile profile1 = new NeoDatis.Odb.Test.VO.Login.Profile ("operator 1", list); NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("olivier smadja" , "*****@*****.**", profile1); NeoDatis.Odb.Test.VO.Login.User userB = new NeoDatis.Odb.Test.VO.Login.User("Aísa Galvão Smadja" , "*****@*****.**", profile1); odb.Store(user); odb.Store(userB); odb.Close(); odb = Open("t4.neodatis"); NeoDatis.Odb.Objects users = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User ), true); NeoDatis.Odb.Objects profiles = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Profile ), true); NeoDatis.Odb.Objects functions = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function ), true); // assertEquals(nbUsers+2,users.size()); NeoDatis.Odb.Test.VO.Login.User user2 = (NeoDatis.Odb.Test.VO.Login.User)users.GetFirst (); AssertEquals(user.ToString(), user2.ToString()); AssertEquals(nbProfiles + 1, profiles.Count); AssertEquals(nbFunctions + 2, functions.Count); odb.Close(); DeleteBase("t4.neodatis"); }
/// <exception cref="System.Exception"></exception> public virtual void TestBufferSize() { int size = NeoDatis.Odb.OdbConfiguration.GetDefaultBufferSizeForData(); NeoDatis.Odb.OdbConfiguration.SetDefaultBufferSizeForData(5); DeleteBase("ti1.neodatis"); NeoDatis.Odb.ODB odb = Open("ti1.neodatis"); System.Text.StringBuilder b = new System.Text.StringBuilder(); for (int i = 0; i < 1000; i++) { b.Append("login - login "); } NeoDatis.Odb.Test.VO.Login.Function login = new NeoDatis.Odb.Test.VO.Login.Function (b.ToString()); NeoDatis.Odb.Test.VO.Login.Profile profile1 = new NeoDatis.Odb.Test.VO.Login.Profile ("operator 1", login); NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("olivier smadja" , "*****@*****.**", profile1); odb.Store(user); odb.Commit(); NeoDatis.Odb.Objects users = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User ), true); NeoDatis.Odb.Objects profiles = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Profile ), true); NeoDatis.Odb.Objects functions = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function ), true); odb.Close(); // assertEquals(nbUsers+2,users.size()); NeoDatis.Odb.Test.VO.Login.User user2 = (NeoDatis.Odb.Test.VO.Login.User)users.GetFirst (); AssertEquals(user.ToString(), user2.ToString()); AssertEquals(b.ToString(), user2.GetProfile().GetFunctions().GetEnumerator().Current .ToString()); DeleteBase("ti1.neodatis"); NeoDatis.Odb.OdbConfiguration.SetDefaultBufferSizeForData(size); }
/// <exception cref="System.Exception"></exception> public virtual void TestCompositeCollection1() { DeleteBase("t31.neodatis"); NeoDatis.Odb.ODB odb = Open("t31.neodatis"); NeoDatis.Odb.Test.VO.Login.Function login = new NeoDatis.Odb.Test.VO.Login.Function ("login"); System.Collections.IList list = new System.Collections.ArrayList(); list.Add(login); NeoDatis.Odb.Test.VO.Login.Profile profile1 = new NeoDatis.Odb.Test.VO.Login.Profile ("operator 1", list); NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("olivier smadja" , "*****@*****.**", profile1); odb.Store(user); odb.Close(); odb = Open("t31.neodatis"); NeoDatis.Odb.Objects users = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User ), true); odb.Close(); // assertEquals(nbUsers+2,users.size()); NeoDatis.Odb.Test.VO.Login.User user2 = (NeoDatis.Odb.Test.VO.Login.User)users.GetFirst (); AssertEquals(user.ToString(), user2.ToString()); DeleteBase("t31.neodatis"); }
/// <exception cref="System.Exception"></exception> public virtual void Test2() { DeleteBase("t2.neodatis"); NeoDatis.Odb.ODB odb = Open("t2.neodatis"); int nbUsers = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User)).Count; int nbProfiles = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Profile), true) .Count; int nbFunctions = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function), true ).Count; NeoDatis.Odb.Test.VO.Login.Function login = new NeoDatis.Odb.Test.VO.Login.Function ("login"); NeoDatis.Odb.Test.VO.Login.Function logout = new NeoDatis.Odb.Test.VO.Login.Function ("logout"); System.Collections.IList list = new System.Collections.ArrayList(); list.Add(login); list.Add(logout); NeoDatis.Odb.Test.VO.Login.Profile profile = new NeoDatis.Odb.Test.VO.Login.Profile ("operator", list); NeoDatis.Odb.Test.VO.Login.User olivier = new NeoDatis.Odb.Test.VO.Login.User("olivier smadja" , "*****@*****.**", profile); NeoDatis.Odb.Test.VO.Login.User aisa = new NeoDatis.Odb.Test.VO.Login.User("Aísa Galvão Smadja" , "*****@*****.**", profile); odb.Store(olivier); odb.Store(aisa); odb.Commit(); NeoDatis.Odb.Objects users = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User ), true); NeoDatis.Odb.Objects profiles = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Profile ), true); NeoDatis.Odb.Objects functions = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function ), true); odb.Close(); // println("Users:"+users); Println("Profiles:" + profiles); Println("Functions:" + functions); odb = Open("t2.neodatis"); NeoDatis.Odb.Objects l = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User), true); odb.Close(); AssertEquals(nbUsers + 2, users.Count); NeoDatis.Odb.Test.VO.Login.User user2 = (NeoDatis.Odb.Test.VO.Login.User)users.GetFirst (); AssertEquals(olivier.ToString(), user2.ToString()); AssertEquals(nbProfiles + 1, profiles.Count); AssertEquals(nbFunctions + 2, functions.Count); NeoDatis.Odb.ODB odb2 = Open("t2.neodatis"); l = odb2.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function), true); NeoDatis.Odb.Test.VO.Login.Function function = (NeoDatis.Odb.Test.VO.Login.Function )l.GetFirst(); function.SetName("login function"); odb2.Store(function); odb2.Close(); NeoDatis.Odb.ODB odb3 = Open("t2.neodatis"); NeoDatis.Odb.Objects l2 = odb3.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.User) , true); int i = 0; while (l2.HasNext() && i < System.Math.Min(2, l2.Count)) { NeoDatis.Odb.Test.VO.Login.User user = (NeoDatis.Odb.Test.VO.Login.User)l2.Next(); AssertEquals("login function", string.Empty + user.GetProfile().GetFunctions()[0] ); i++; } odb3.Close(); DeleteBase("t2.neodatis"); }