Beispiel #1
0
        public virtual void TestCriteriaQueryQueryWithValueInList()
		{
			string baseName = GetBaseName();
            SetUp(baseName);
			NeoDatis.Odb.ODB odb = Open(baseName);
			Profile p0 = new Profile("profile0"
				);
			p0.AddFunction(null);
			p0.AddFunction(new Function("f1"));
			p0.AddFunction(new Function("f2"));
			Profile p1 = new Profile("profile1"
				);
			p1.AddFunction(null);
			p1.AddFunction(new Function("f12"));
			p1.AddFunction(new Function("f22"));
			User user = new User("The user"
				, "themail", p0);
			User user2 = new User("The user2"
				, "themail2", p1);
			odb.Store(user);
			odb.Store(user2);
			odb.Close();
			odb = Open(baseName);
			Function f2bis = (Function)
				odb.GetObjects<Function> (new CriteriaQuery(Where.Equal("name", "f2"))).GetFirst();
			CriteriaQuery query = odb.CriteriaQuery(typeof(
				User), Where.Contain
				("profile.functions", f2bis));
			NeoDatis.Odb.Objects<User> l = odb.GetObjects<User>(query);
			AssertEquals(1, l.Count);
			user = (User)l.GetFirst();
			AssertEquals("The user", user.GetName());
			odb.Close();
		}
Beispiel #2
0
		/// <exception cref="System.Exception"></exception>
		public virtual void TestCriteriaQueryQueryWithObject()
		{
			string baseName = GetBaseName();
			NeoDatis.Odb.ODB odb = Open(baseName);
			Profile p0 = new Profile("profile0"
				);
			p0.AddFunction(null);
			p0.AddFunction(new Function("f1"));
			p0.AddFunction(new Function("f2"));
			Profile p1 = new Profile("profile1"
				);
			p1.AddFunction(null);
			p1.AddFunction(new Function("f12"));
			p1.AddFunction(new Function("f22"));
			User user = new User("The user"
				, "themail", p0);
			User user2 = new User("The user2"
				, "themail2", p1);
			odb.Store(user);
			odb.Store(user2);
			odb.Close();
			odb = Open(baseName);
			Profile pp = (Profile)odb.GetObjects<Profile>
				(new CriteriaQuery(Where.Equal("name", "profile0"))).GetFirst();
			CriteriaQuery query = new CriteriaQuery(Where.Equal("profile", pp));
			NeoDatis.Odb.Objects<User> l = odb.GetObjects<User>(query);
			AssertEquals(1, l.Count);
			user = (User)l.GetFirst();
			AssertEquals("The user", user.GetName());
			odb.Close();
		}
Beispiel #3
0
        /// <exception cref="System.Exception"></exception>
        public virtual void TestComplexInstance()
        {
            DeleteBase("t-complex-instance.neodatis");
            NeoDatis.Odb.ODB odb   = Open("t-complex-instance.neodatis");
            Function         login = new Function
                                         ("login");
            Function logout = new Function
                                  ("logout");
            List <Function> functions = new List <Function>();

            functions.Add(login);
            functions.Add(logout);
            Profile profile = new Profile("profile1", functions);

            NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("oliver"
                                                                                       , "*****@*****.**", profile);
            NeoDatis.Odb.Test.VO.Login.User user22 = new NeoDatis.Odb.Test.VO.Login.User("oliver2"
                                                                                         , "*****@*****.**", profile);
            odb.Store(user);
            odb.Store(user22);
            odb.Close();
            odb = Open("t-complex-instance.neodatis");
            NeoDatis.Odb.Objects <NeoDatis.Odb.Test.VO.Login.User> l = odb.GetObjects <NeoDatis.Odb.Test.VO.Login.User>(true);
            NeoDatis.Odb.Test.VO.Login.User user2 = l.GetFirst();
            // println("#### " + l.size() + " : " + l);
            AssertEquals(user.GetName(), user2.GetName());
            AssertEquals(user.GetEmail(), user2.GetEmail());
            AssertEquals(user.GetProfile().GetName(), user2.GetProfile().GetName());
            AssertEquals(user.GetProfile().GetFunctions()[0].ToString(), user2.GetProfile().GetFunctions
                             ()[0].ToString());
            odb.Close();
            DeleteBase("t-complex-instance.neodatis");
        }
Beispiel #4
0
        /// <exception cref="System.Exception"></exception>
        public virtual void T1estG1()
        {
            test.DeleteBase("acid1");
            NeoDatis.Odb.ODB odb = test.Open("acid1");
            int size             = 1000;

            NeoDatis.Odb.OID[] oids = new NeoDatis.Odb.OID[size];
            for (int i = 0; i < size; i++)
            {
                oids[i] = odb.Store(GetInstance("f" + i));
                if (simpleObject)
                {
                    NeoDatis.Odb.Test.VO.Login.Function f = (NeoDatis.Odb.Test.VO.Login.Function)odb.
                                                            GetObjectFromId(oids[i]);
                    f.SetName("function " + i);
                    odb.Store(f);
                    odb.Store(f);
                    odb.Store(f);
                    odb.Store(f);
                }
                else
                {
                    NeoDatis.Odb.Test.VO.Login.User f = (NeoDatis.Odb.Test.VO.Login.User)odb.GetObjectFromId
                                                            (oids[i]);
                    f.SetName("function " + i);
                    odb.Store(f);
                    odb.Store(f);
                    odb.Store(f);
                    odb.Store(f);
                }
            }
            odb.Commit();
        }
Beispiel #5
0
 public virtual void Test1()
 {
     DeleteBase("null.neodatis");
     NeoDatis.Odb.ODB odb = Open("null.neodatis");
     NeoDatis.Odb.Test.VO.Login.User user1 = new NeoDatis.Odb.Test.VO.Login.User("oli"
                                                                                 , "oli@sdsadf", null);
     NeoDatis.Odb.Test.VO.Login.User user2 = new NeoDatis.Odb.Test.VO.Login.User("karine"
                                                                                 , "karine@sdsadf", null);
     NeoDatis.Odb.Test.VO.Login.User user3 = new NeoDatis.Odb.Test.VO.Login.User(null,
                                                                                 null, null);
     odb.Store(user1);
     odb.Store(user2);
     odb.Store(user3);
     odb.Close();
     odb = Open("null.neodatis");
     NeoDatis.Odb.Objects <User> l = odb.GetObjects <User>(true);
     AssertEquals(3, l.Count);
     user1 = (NeoDatis.Odb.Test.VO.Login.User)l.Next();
     AssertEquals("oli", user1.GetName());
     AssertEquals("oli@sdsadf", user1.GetEmail());
     AssertEquals(null, user1.GetProfile());
     user2 = (NeoDatis.Odb.Test.VO.Login.User)l.Next();
     AssertEquals("karine", user2.GetName());
     AssertEquals("karine@sdsadf", user2.GetEmail());
     AssertEquals(null, user2.GetProfile());
     user3 = (NeoDatis.Odb.Test.VO.Login.User)l.Next();
     AssertEquals(null, user3.GetName());
     AssertEquals(null, user3.GetEmail());
     AssertEquals(null, user3.GetProfile());
     odb.Close();
     DeleteBase("null.neodatis");
 }
Beispiel #6
0
        public virtual void Test1()
		{
			DeleteBase("null.neodatis");
			NeoDatis.Odb.ODB odb = Open("null.neodatis");
			NeoDatis.Odb.Test.VO.Login.User user1 = new NeoDatis.Odb.Test.VO.Login.User("oli"
				, "oli@sdsadf", null);
			NeoDatis.Odb.Test.VO.Login.User user2 = new NeoDatis.Odb.Test.VO.Login.User("karine"
				, "karine@sdsadf", null);
			NeoDatis.Odb.Test.VO.Login.User user3 = new NeoDatis.Odb.Test.VO.Login.User(null, 
				null, null);
			odb.Store(user1);
			odb.Store(user2);
			odb.Store(user3);
			odb.Close();
			odb = Open("null.neodatis");
			NeoDatis.Odb.Objects<User> l = odb.GetObjects<User>(true);
			AssertEquals(3, l.Count);
			user1 = (NeoDatis.Odb.Test.VO.Login.User)l.Next();
			AssertEquals("oli", user1.GetName());
			AssertEquals("oli@sdsadf", user1.GetEmail());
			AssertEquals(null, user1.GetProfile());
			user2 = (NeoDatis.Odb.Test.VO.Login.User)l.Next();
			AssertEquals("karine", user2.GetName());
			AssertEquals("karine@sdsadf", user2.GetEmail());
			AssertEquals(null, user2.GetProfile());
			user3 = (NeoDatis.Odb.Test.VO.Login.User)l.Next();
			AssertEquals(null, user3.GetName());
			AssertEquals(null, user3.GetEmail());
			AssertEquals(null, user3.GetProfile());
			odb.Close();
			DeleteBase("null.neodatis");
		}
Beispiel #7
0
        public virtual void Test9()
		{
			// reset counter to checks update type (normal or updates)
			NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.AbstractObjectWriter.ResetNbUpdates();
			DeleteBase(Name);
			NeoDatis.Odb.ODB odb = Open(Name);
			User user = new User("name"
				, "email", new Profile("p1", new Function
				("function")));
			odb.Store(user);
			odb.Store(new Profile("new profile"));
			odb.Close();
			odb = Open(Name);
			Profile p = (Profile)odb.GetObjects<Profile>(new CriteriaQuery(Where.Equal("name", "new profile"))).GetFirst
				();
			p.SetName("new profile2");
			User user2 = (User)odb.GetObjects<User>().GetFirst();
			user2.SetProfile(p);
			odb.Store(user2);
			odb.Close();
			odb = Open(Name);
			User user3 = (User)odb.GetObjects<User>().GetFirst();
			AssertNotNull(user3.GetProfile());
			odb.Close();
			DeleteBase(Name);
			AssertEquals("new profile2", user3.GetProfile().GetName());
		}
        public virtual void Test2()
		{
			DeleteBase("t2.neodatis");
			NeoDatis.Odb.ODB odb = Open("t2.neodatis");
			int nbUsers = odb.GetObjects<User>().Count;
			int nbProfiles = odb.GetObjects<Profile>(true).Count;
			int nbFunctions = odb.GetObjects<Function>(true).Count;
			Function login = new Function
				("login");
			Function logout = new Function
				("logout");
            System.Collections.Generic.IList<Function> list = new System.Collections.Generic.List<Function>();
			list.Add(login);
			list.Add(logout);
			Profile profile = new Profile("operator", list);
			User olivier = new User("olivier smadja"
				, "*****@*****.**", profile);
			User aisa = new User("Aísa Galvão Smadja"
				, "*****@*****.**", profile);
			odb.Store(olivier);
			odb.Store(aisa);
			odb.Commit();
			NeoDatis.Odb.Objects<User> users = odb.GetObjects<User>(true);
			NeoDatis.Odb.Objects<Profile> profiles = odb.GetObjects<Profile>(true);
			NeoDatis.Odb.Objects<Function> functions = odb.GetObjects<Function>(true);
			odb.Close();
			// println("Users:"+users);
			Println("Profiles:" + profiles);
			Println("Functions:" + functions);
			odb = Open("t2.neodatis");
			NeoDatis.Odb.Objects<User> l = odb.GetObjects<User>(true);
			odb.Close();
			AssertEquals(nbUsers + 2, users.Count);
			User user2 = (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");
			Objects<Function> l2 = odb2.GetObjects<Function>(true);
			Function function = l2.GetFirst();
			function.SetName("login function");
			odb2.Store(function);
			odb2.Close();
			NeoDatis.Odb.ODB odb3 = Open("t2.neodatis");
			NeoDatis.Odb.Objects<User> l3 = odb3.GetObjects<User>(true);
			int i = 0;
			while (l3.HasNext() && i < System.Math.Min(2, l3.Count))
			{
				User user = (User)l3.Next();
				AssertEquals("login function", string.Empty + user.GetProfile().GetFunctions()[0]
					);
				i++;
			}
			odb3.Close();
			DeleteBase("t2.neodatis");
		}
Beispiel #9
0
		private object GetInstance()
		{
			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.Generic.List<Function> list = new System.Collections.Generic.List<Function>();
			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 user = new NeoDatis.Odb.Test.VO.Login.User("olivier smadja"
				, "*****@*****.**", profile);
			return user;
		}
Beispiel #10
0
 private object GetInstance(int i)
 {
     NeoDatis.Odb.Test.VO.Login.Function login = new NeoDatis.Odb.Test.VO.Login.Function
                                                     ("login " + i);
     NeoDatis.Odb.Test.VO.Login.Function logout = new NeoDatis.Odb.Test.VO.Login.Function
                                                      ("logout" + i);
     System.Collections.Generic.IList <Function> list = new System.Collections.Generic.List <Function>();
     list.Add(login);
     list.Add(logout);
     NeoDatis.Odb.Test.VO.Login.Profile profile = new NeoDatis.Odb.Test.VO.Login.Profile
                                                      ("operator" + i, list);
     NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("kiko"
                                                                                + i, "*****@*****.**" + i, profile);
     return(user);
 }
Beispiel #11
0
 private object GetInstance(string @string)
 {
     if (simpleObject)
     {
         return(new NeoDatis.Odb.Test.VO.Login.Function(@string));
     }
     NeoDatis.Odb.Test.VO.Login.Profile p = new NeoDatis.Odb.Test.VO.Login.Profile(@string
                                                                                   );
     p.AddFunction(new NeoDatis.Odb.Test.VO.Login.Function("function " + @string + "1"
                                                           ));
     p.AddFunction(new NeoDatis.Odb.Test.VO.Login.Function("function " + @string + "2"
                                                           ));
     NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User(@string
                                                                                , "email" + @string, p);
     return(user);
 }
Beispiel #12
0
        static public void Test2()
        {
            String baseName = "t1.neodatis";
            ODB odb = ODBFactory.Open(baseName);
            Function f = new Function("f1");
            Profile profile = new Profile("profile1", f);
            User user = new User("user name", "email", profile);
            odb.Store(user);
            odb.Close();

            odb = ODBFactory.Open(baseName);
            Objects<User> users = odb.GetObjects<User>(new CriteriaQuery(Where.Equal("name", "user name")));
            Console.WriteLine(users.Count + " users");
            odb.Close();
            Console.ReadLine();


        }
Beispiel #13
0
        public virtual void Test7()
        {
            DeleteBase("getid.neodatis");
            int size = isLocal ? 10001 : 1000;

            NeoDatis.Odb.ODB   odb  = Open("getid.neodatis");
            NeoDatis.Odb.OID[] oids = new NeoDatis.Odb.OID[size];
            for (int i = 0; i < size; i++)
            {
                oids[i] = odb.Store(GetInstance(i));
            }
            odb.Close();
            odb = Open("getid.neodatis");
            long t1 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            for (int i = 0; i < size; i++)
            {
                NeoDatis.Odb.Test.VO.Login.User u = (NeoDatis.Odb.Test.VO.Login.User)odb.GetObjectFromId
                                                        (oids[i]);
                AssertEquals("kiko" + i, u.GetName());
            }
            long t2 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            odb.Close();
            DeleteBase("getid.neodatis");
            long   time           = t2 - t1;
            double timeForEachGet = (double)time / (double)size;
            double acceptableTime = isLocal ? 0.086 : 1.6;

            // 0.1561843815618438
            Println("time for each get = " + timeForEachGet + " - Total time for " + size + " objects = "
                    + time);
            if (testPerformance && timeForEachGet > acceptableTime)
            {
                // ms
                Println("time for each get = " + timeForEachGet + " - Total time for " + size + " objects = "
                        + time);
                Fail("Getting " + size + " complex objects by oid lasted more than " + acceptableTime
                     + "ms : " + timeForEachGet);
            }
        }
Beispiel #14
0
        public virtual void TestCompositeCollection2DifferentObjects()
		{
			DeleteBase("ti1.neodatis");
			NeoDatis.Odb.ODB odb = Open("ti1.neodatis");
			int nbUsers = odb.GetObjects<User>(true).Count;
			int nbProfiles = odb.GetObjects<Profile>(true).Count;
			int nbFunctions = odb.GetObjects<Function>(true).Count;
			Function login = new Function("login");
			Function logout = new Function("logout");
			Function disconnect = new Function("disconnect");
			System.Collections.Generic.IList<Function> list = new System.Collections.Generic.List<Function>();
			list.Add(login);
			list.Add(logout);
            System.Collections.Generic.IList<Function> list2 = new System.Collections.Generic.List<Function>();
			list.Add(login);
			list.Add(logout);
			Profile profile1 = new Profile
				("operator 1", list);
			Profile profile2 = new Profile
				("operator 2", list2);
			User user = new User("olivier smadja"
				, "*****@*****.**", profile1);
			User userB = new User("A√°sa Galv√£o Smadja"
				, "*****@*****.**", profile2);
			odb.Store(user);
			odb.Store(userB);
			odb.Commit();
			NeoDatis.Odb.Objects<Function> functions = odb.GetObjects<Function>(true);
			NeoDatis.Odb.Objects<Profile> profiles = odb.GetObjects<Profile>(true);
			NeoDatis.Odb.Objects<User> users = odb.GetObjects<User>(true);
			odb.Close();
			// assertEquals(nbUsers+2,users.size());
			User user2 = (User)users.GetFirst
				();
			AssertEquals(user.ToString(), user2.ToString());
			AssertEquals(nbProfiles + 2, profiles.Count);
			AssertEquals(nbFunctions + 2, functions.Count);
			DeleteBase("ti1.neodatis");
		}
Beispiel #15
0
        public virtual void Test7Ordering()
        {
            if (!isLocal)
            {
                return;
            }
            NeoDatis.Odb.ODB odb = Open("get.neodatis");
            NeoDatis.Odb.Core.Query.NQ.SimpleNativeQuery query = new _SimpleNativeQuery_183();
            query.OrderByDesc("name");
            NeoDatis.Odb.Objects <User> l = odb.GetObjects <User>(query, true);
            int i = l.Count - 1;

            AssertFalse(l.Count == 0);
            while (l.HasNext())
            {
                NeoDatis.Odb.Test.VO.Login.User user = (NeoDatis.Odb.Test.VO.Login.User)l.Next();
                AssertEquals("olivier " + i, user.GetName());
                // println(user.getName());
                i--;
            }
            odb.Close();
        }
Beispiel #16
0
        public virtual void Test2()
		{
			if (!isLocal)
			{
				return;
			}
			NeoDatis.Odb.ODB odb = null;
			DeleteBase("trigger.neodatis");
			NeoDatis.Odb.Test.Trigger.MyTrigger myTrigger = new NeoDatis.Odb.Test.Trigger.MyTrigger
				();
			try
			{
				odb = Open("trigger.neodatis");
				odb.AddInsertTrigger(typeof(Function), myTrigger);
				Function f1 = new Function(
					"function1");
				Function f2 = new Function(
					"function2");
				Profile profile = new Profile
					("profile1", f1);
				User user = new User("oli", 
					"*****@*****.**", profile);
				odb.Store(user);
				odb.Store(f2);
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
			}
			odb = Open("trigger.neodatis");
			odb.Close();
			DeleteBase("trigger.neodatis");
			AssertEquals(2, myTrigger.nbInsertsBefore);
			AssertEquals(2, myTrigger.nbInsertsAfter);
		}
Beispiel #17
0
        public virtual void TestCompositeCollection1()
		{
			DeleteBase("t31.neodatis");
			NeoDatis.Odb.ODB odb = Open("t31.neodatis");
			Function login = new Function
				("login");
			System.Collections.Generic.IList<Function> list = new System.Collections.Generic.List<Function>();
			list.Add(login);
			Profile profile1 = new Profile
				("operator 1", list);
			User user = new User("olivier smadja"
				, "*****@*****.**", profile1);
			odb.Store(user);
			odb.Close();
			odb = Open("t31.neodatis");
			NeoDatis.Odb.Objects<User> users = odb.GetObjects<User>(true);
			odb.Close();
			// assertEquals(nbUsers+2,users.size());
			User user2 = (User)users.GetFirst
				();
			AssertEquals(user.ToString(), user2.ToString());
			DeleteBase("t31.neodatis");
		}
Beispiel #18
0
        public virtual void Test8Ordering()
        {
            if (!isLocal)
            {
                return;
            }
            NeoDatis.Odb.ODB odb = Open("get.neodatis");
            NeoDatis.Odb.Core.Query.NQ.SimpleNativeQuery query = new _SimpleNativeQuery_208();
            query.OrderByAsc("name,email");
            NeoDatis.Odb.Objects <User> l = odb.GetObjects <User>(query, true);
            AssertFalse(l.Count == 0);
            int i = 0;

            while (l.HasNext())
            {
                NeoDatis.Odb.Test.VO.Login.User user = (NeoDatis.Odb.Test.VO.Login.User)l.Next();
                // println(user.getName() + " / " + user.getEmail());
                AssertEquals("olivier " + i / 3, user.GetName());
                AssertEquals("[email protected] " + ((i % 3) + 1), user.GetEmail());
                i++;
            }
            odb.Close();
        }
Beispiel #19
0
        public virtual void Test8()
		{
			// reset counter to checks update type (normal or updates)
			NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.AbstractObjectWriter.ResetNbUpdates();
			if (!isLocal)
			{
				return;
			}
			DeleteBase(Name);
			NeoDatis.Odb.ODB odb = Open(Name);
			User user = new User("name"
				, "email", new Profile("p1", new Function
				("function")));
			odb.Store(user);
			odb.Close();
			odb = Open(Name);
			Profile p = (Profile)odb.GetObjects<Profile>().GetFirst();
			odb.Delete(p);
			odb.Close();
			odb = Open(Name);
			User user3 = (User)odb.GetObjects<User>().GetFirst();
			AssertNull(user3.GetProfile());
			user3.SetProfile(new Profile("new profile", new Function
				("f1")));
			user3.SetEmail("email2");
			user3.SetName("name2");
			odb.Store(user3);
			odb.Close();
			odb = Open(Name);
			User user4 = (User)odb.GetObjects<User>().GetFirst();
			odb.Close();
			DeleteBase(Name);
			AssertEquals("new profile", user4.GetProfile().GetName());
			AssertEquals("email2", user4.GetEmail());
			AssertEquals("name2", user4.GetName());
		}
Beispiel #20
0
        /// <exception cref="System.Exception"></exception>
        public virtual void T1estL1()
        {
            test.DeleteBase("acid1");
            NeoDatis.Odb.ODB odb = test.Open("acid1");
            odb.Store(GetInstance("f1"));
            odb.Store(GetInstance("f2"));
            NeoDatis.Odb.OID oid = odb.Store(GetInstance("f3"));
            odb.Commit();
            object o = odb.GetObjectFromId(oid);

            if (simpleObject)
            {
                NeoDatis.Odb.Test.VO.Login.Function f = (NeoDatis.Odb.Test.VO.Login.Function)o;
                f.SetName("flksjdfjs;dfsljflsjflksjfksjfklsdjfksjfkalsjfklsdjflskd");
                odb.Store(f);
            }
            else
            {
                NeoDatis.Odb.Test.VO.Login.User f = (NeoDatis.Odb.Test.VO.Login.User)o;
                f.SetName("flksjdfjs;dfsljflsjflksjfksjfklsdjfksjfkalsjfklsdjflskd");
                odb.Store(f);
            }
            odb.Rollback();
        }
Beispiel #21
0
        static public void Test3()
        {
            
            String baseName = "t2.neodatis";
            File.Delete(baseName);
            ODB odb = ODBFactory.Open(baseName);
            
            int size = 10000;
            DateTime now = DateTime.Now;
            for (int i = 0; i < size; i++)
            {
                Function f = new Function("f1 "+i);
                Profile profile = new Profile("profile1"+i, f);
                User user = new User("user name"+i, "email"+i, profile);
                odb.Store(user);
            }
            odb.Close();
            Console.WriteLine("time for insert = " + (DateTime.Now - now).Ticks/10000);
            
            odb = ODBFactory.Open(baseName);

            long t0 = DateTime.Now.Ticks;
            //Objects<User> users = odb.GetObjects<User>(new CriteriaQuery(Where.Like("name", "user name")));
            Objects<User> users = odb.GetObjects<User>(false);
            long t1 = DateTime.Now.Ticks;
            Console.WriteLine(users.Count + " users");
            while (users.HasNext())
            {
                users.Next();
            }
            long t2 = DateTime.Now.Ticks;
            Console.WriteLine("Get=" + (t1 - t0) / 10000 + "  - actual Get = " + (t2 - t1)/10000);
            odb.Close();
            Console.ReadLine();


        }
Beispiel #22
0
        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<User>(true).Count;
			int nbProfiles = odb.GetObjects<Profile>(true).Count;
			int nbFunctions = odb.GetObjects<Function>(true).Count;
			Function login = new Function("login");
			Function logout = new Function("logout");
			System.Collections.Generic.IList<Function> list = new System.Collections.Generic.List<Function>();
			list.Add(login);
			list.Add(logout);
			Profile profile1 = new Profile
				("operator 1", list);
			User user = new User("olivier smadja"
				, "*****@*****.**", profile1);
			User userB = new User("Aísa Galvão Smadja"
				, "*****@*****.**", profile1);
			odb.Store(user);
			odb.Store(userB);
			odb.Close();
			odb = Open("t4.neodatis");
			NeoDatis.Odb.Objects<User> users = odb.GetObjects<User>(true);
			NeoDatis.Odb.Objects<Profile> profiles = odb.GetObjects<Profile>(true);
			NeoDatis.Odb.Objects<Function> functions = odb.GetObjects<Function>(true);
			// assertEquals(nbUsers+2,users.size());
			User user2 = (User)users.GetFirst
				();
			AssertEquals(user.ToString(), user2.ToString());
			AssertEquals(nbProfiles + 1, profiles.Count);
			AssertEquals(nbFunctions + 2, functions.Count);
			odb.Close();
			DeleteBase("t4.neodatis");
		}
Beispiel #23
0
		/// <exception cref="System.Exception"></exception>
		public virtual void Test1WithCommit2()
		{
			if (!runAll)
			{
				return;
			}
			NeoDatis.Tool.StopWatch stopWatch = new NeoDatis.Tool.StopWatch();
			stopWatch.Start();
			int size = 2;
			int size2 = 1;
			int nbFunctions = 1;
			DeleteBase(FileName);
			NeoDatis.Odb.ODB odb = Open(FileName);
			Function f1 = new Function(
				"function 1");
			Println(odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof(
				User))));
			// 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);
				if (i % 100 == 0)
				{
					Println("insert " + i);
				}
			}
			odb.Close();
			Println("created");
			// Updates 10 times the objects
			odb = Open(FileName);
			NeoDatis.Odb.Objects<User> objects = odb.GetObjects<User>();
			Println("got the object " + objects.Count);
			for (int k = 0; k < 3; k++)
			{
				objects.Reset();
				long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
				for (int i = 0; i < size; i++)
				{
					User user = (User)objects.Next
						();
					user.GetProfile().SetName(user.GetProfile().GetName() + "-updated");
					odb.Store(user);
					if (i % 100 == 0)
					{
						Println("update " + i + " - " + k);
					}
				}
				Println("Update " + k + " - " + (NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs
					() - start) + " ms");
			}
			Println("updated");
			Println("deleted");
			odb.Close();
			// Check object count
			odb = Open(FileName);
			objects = odb.GetObjects<User>();
			AssertEquals(objects.Count, size);
			// 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", 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");
			odb.Close();
			// delete objects
			odb = Open(FileName);
			objects = odb.GetObjects<User>();
			a = 0;
			while (objects.HasNext())
			{
				odb.Delete(objects.Next());
				a++;
			}
			AssertEquals(size, a);
			odb.Close();
			odb = Open(FileName);
			AssertEquals(0, odb.GetObjects<User>().Count);
			AssertEquals(0, odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
				(typeof(User))));
			Println("deleted");
			odb.Close();
			stopWatch.End();
			Println("Total time 1 = " + stopWatch.GetDurationInMiliseconds());
			if (stopWatch.GetDurationInMiliseconds() > 90700)
			{
				Fail("time is > than " + 90700 + " = " + stopWatch.GetDurationInMiliseconds());
			}
		}
Beispiel #24
0
		/// <exception cref="System.Exception"></exception>
		public virtual void Test1WithCommit3()
		{
			if (!runAll)
			{
				return;
			}
			NeoDatis.Tool.StopWatch stopWatch = new NeoDatis.Tool.StopWatch();
			stopWatch.Start();
			DeleteBase(FileName);
			NeoDatis.Odb.ODB odb = Open(FileName);
			Function f1 = new Function(
				"function 1");
			Println(odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof(
				User))));
			NeoDatis.Odb.Test.VO.Login.Profile p = new NeoDatis.Odb.Test.VO.Login.Profile("profile number 0"
				, f1);
			p.AddFunction(new Function("f1"));
			User user = new User("user name 0"
				, "user email 0", p);
			odb.Store(user);
			NeoDatis.Odb.Test.VO.Login.Profile p2 = new NeoDatis.Odb.Test.VO.Login.Profile("profile number 0"
				, f1);
			p2.AddFunction(new Function("f2"));
			User user2 = new User("user name 0"
				, "user email 0", p2);
			odb.Store(user2);
			odb.Close();
			odb = Open(FileName);
			NeoDatis.Odb.Objects<User> objects = null;
			for (int k = 0; k < 2; k++)
			{
				System.Console.Out.WriteLine(":" + k);
				objects = odb.GetObjects<User>();
				while (objects.HasNext())
				{
					user = (User)objects.Next();
					user.GetProfile().SetName(user.GetProfile().GetName() + "-updated");
					Println(user.GetProfile().GetName());
					odb.Store(user);
				}
			}
			odb.Close();
			odb = Open(FileName);
			objects = odb.GetObjects<User>();
			AssertEquals(2, objects.Count);
			odb.Close();
		}
Beispiel #25
0
        public virtual void TestInsertSimpleObjectODB()
        {
            bool inMemory = true;

            // Deletes the database file
            NeoDatis.Tool.IOUtil.DeleteFile(OdbFileName);
            long t1  = 0;
            long t2  = 0;
            long t3  = 0;
            long t4  = 0;
            long t5  = 0;
            long t6  = 0;
            long t7  = 0;
            long t77 = 0;
            long t8  = 0;

            NeoDatis.Odb.ODB                odb = null;
            NeoDatis.Odb.Objects <User>     l   = null;
            NeoDatis.Odb.Test.VO.Login.User so  = null;
            // Insert TEST_SIZE objects
            System.Console.Out.WriteLine("Inserting " + TestSize + " objects");
            t1  = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            odb = NeoDatis.Odb.ODBFactory.Open(OdbFileName);
            odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Login.User)).AddFullInstantiationHelper
                (new NeoDatis.Odb.Test.Performance.UserFullInstantiationHelper());
            for (int i = 0; i < TestSize; i++)
            {
                object o = GetUserInstance(i);
                odb.Store(o);
            }
            t2 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            // Closes the database
            odb.Close();
            t3 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            System.Console.Out.WriteLine("Retrieving " + TestSize + " objects");
            // Reopen the database
            odb = NeoDatis.Odb.ODBFactory.Open(OdbFileName);
            // Gets retrieve the TEST_SIZE objects
            l  = odb.GetObjects <User>(inMemory);
            t4 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            // Actually get objects
            while (l.HasNext())
            {
                object o = l.Next();
            }
            t5 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            System.Console.Out.WriteLine("Updating " + TestSize + " objects");
            so = null;
            l.Reset();
            // Actually get objects
            while (l.HasNext())
            {
                so = (NeoDatis.Odb.Test.VO.Login.User)l.Next();
                // so.setName(so.getName() + " updated");
                // so.setName(so.getName() + " updated-updated-updated-updated");
                so.GetProfile().SetName(so.GetName() + " updated-updated-updated");
                odb.Store(so);
            }
            t6 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            odb.Close();
            t7 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            System.Console.Out.WriteLine("Deleting " + TestSize + " objects");
            odb = NeoDatis.Odb.ODBFactory.Open(OdbFileName);
            l   = odb.GetObjects <User>(inMemory);
            t77 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            // Actually get objects
            while (l.HasNext())
            {
                so = (NeoDatis.Odb.Test.VO.Login.User)l.Next();
                odb.Delete(so);
            }
            odb.Close();
            t8  = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            odb = NeoDatis.Odb.ODBFactory.Open(OdbFileName);
            odb.Close();
            DisplayResult("ODB " + TestSize + " User objects ", t1, t2, t3, t4, t5, t6, t7, t77
                          , t8);
        }
Beispiel #26
0
		/// <summary>
		/// 1) insert 10000 objects 2) update 5000 * 10 times 3) delete other 5000
		/// 4) check count : must be 5000 5) re-update 5000 * 10 times 6) delete the
		/// other 5000 7) check count - must be zero
		/// </summary>
		/// <exception cref="System.Exception">System.Exception</exception>
		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());
			}
		}
Beispiel #27
0
		public virtual object Instantiate(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 nnoi)
		{
			User user = new User();
			return user;
		}
Beispiel #28
0
        public virtual void Test5()
		{
			DeleteBase("t5.neodatis");
			NeoDatis.Odb.ODB odb = Open("t5.neodatis");
			long nbFunctions = odb.Count(new CriteriaQuery(typeof(Function)));
			long nbProfiles = odb.Count(new CriteriaQuery(typeof(Profile)));
			long nbUsers = odb.Count(new CriteriaQuery(typeof(User)));
			Function login = new Function
				("login");
			Function logout = new Function
				("logout");
            System.Collections.Generic.List<Function> list = new System.Collections.Generic.List<Function>();
			list.Add(login);
			list.Add(logout);
			Profile profile = new Profile("operator", list);
			User olivier = new User("olivier smadja"
				, "*****@*****.**", profile);
			User aisa = new User("Aísa Galvão Smadja"
				, "*****@*****.**", profile);
			odb.Store(olivier);
			odb.Store(profile);
			odb.Commit();
			odb.Close();
			odb = Open("t5.neodatis");
			NeoDatis.Odb.Objects<User> users = odb.GetObjects<User>(true);
			NeoDatis.Odb.Objects<Profile> profiles = odb.GetObjects<Profile>(true);
			NeoDatis.Odb.Objects<Function> functions = odb.GetObjects<Function>( true);
			odb.Close();
			AssertEquals(nbUsers + 1, users.Count);
			AssertEquals(nbProfiles + 1, profiles.Count);
			AssertEquals(nbFunctions + 2, functions.Count);
		}
Beispiel #29
0
		public void SetUp(string baseName)
		{
			NeoDatis.Odb.ODB odb = Open(baseName);
			long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
			int size = 10;
			for (int i = 0; i < size; i++)
			{
				User u = new User("user" + 	i, "email" + i, new Profile("profile" + i, new Function	("function " + i)));
				odb.Store(u);
			}
			User user = new User("big user", "big email", new Profile("big profile", new Function("big function 1")));
			user.GetProfile().AddFunction(new Function("big function 2"));
			user.GetProfile().AddFunction(new Function("big function 3"	));
			user.GetProfile().AddFunction(new Function("big function 4"));
			odb.Store(user);
			user = new User("user no function", "email no function"	, new Profile("profile no function"));
			odb.Store(user);
			odb.Close();
		}
Beispiel #30
0
		private object GetUserInstance(int i)
		{
			Function login = new Function("login" + i);
			Function logout = new Function("logout" + i);
            System.Collections.Generic.List<Function> list = new System.Collections.Generic.List<Function>();
			list.Add(login);
			list.Add(logout);
			Profile profile = new Profile("operator" + i, list);
			User user = new User("olivier smadja" + i, "*****@*****.**", profile);
			return user;
		}
Beispiel #31
0
        public virtual void TestCriteriaQueryQueryWithValueInList2_with_null_object()
		{
			string baseName = GetBaseName();
            SetUp(baseName);
			NeoDatis.Odb.ODB odb = Open(baseName);
			Profile p0 = new Profile("profile0"
				);
			p0.AddFunction(new Function("f1"));
			p0.AddFunction(new Function("f2"));
			Profile p1 = new Profile("profile1"
				);
			p0.AddFunction(new Function("f12"));
			p0.AddFunction(new Function("f22"));
			User user = new User("The user"
				, "themail", p0);
			User user2 = new User("The user2"
				, "themail2", p1);
			odb.Store(user);
			odb.Store(user2);
			odb.Close();
			odb = Open(baseName);
			Function f2bis = new Function
				("f2");
			CriteriaQuery query = new CriteriaQuery
				(typeof(Profile), Where
				.Contain("functions", null));
			NeoDatis.Odb.Objects<Profile> l = odb.GetObjects<Profile>(query
				);
			AssertEquals(1, l.Count);
			p1 = l.GetFirst();
			AssertEquals("profile1", p1.GetName());
			odb.Close();
		}
		private object GetInstance(string @string)
		{
			if (simpleObject)
			{
				return new NeoDatis.Odb.Test.VO.Login.Function(@string);
			}
			NeoDatis.Odb.Test.VO.Login.Profile p = new NeoDatis.Odb.Test.VO.Login.Profile(@string
				);
			p.AddFunction(new NeoDatis.Odb.Test.VO.Login.Function("function " + @string + "1"
				));
			p.AddFunction(new NeoDatis.Odb.Test.VO.Login.Function("function " + @string + "2"
				));
			NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User(@string
				, "email" + @string, p);
			return user;
		}
Beispiel #33
0
        public virtual void TestUpdateObjectReference4()
		{
			DeleteBase(FileName);
			NeoDatis.Odb.ODB odb = Open(FileName);
			Function function = new Function
				("login");
			User user = new User("olivier smadja"
				, "*****@*****.**", null);
			odb.Store(user);
			odb.Close();
			Profile profile2 = new Profile
				("new operator", function);
			odb = Open(FileName);
			odb.Store(profile2);
			User user2 = odb.GetObjects<User>().GetFirst();
			user2.SetProfile(profile2);
			odb.Store(user2);
			odb.Close();
			odb = Open(FileName);
			user2 = odb.GetObjects<User>().GetFirst();
			AssertEquals("new operator", user2.GetProfile().GetName());
			AssertEquals(1, odb.GetObjects<Profile>().Count);
			odb.Close();
		}
Beispiel #34
0
        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 ");
			}
			Function login = new Function
				(b.ToString());
			Profile profile1 = new Profile
				("operator 1", login);
			User user = new User("olivier smadja"
				, "*****@*****.**", profile1);
			odb.Store(user);
			odb.Commit();
			NeoDatis.Odb.Objects<User> users = odb.GetObjects<User>(true);
			NeoDatis.Odb.Objects<Profile> profiles = odb.GetObjects<Profile>(true);
			NeoDatis.Odb.Objects<Function> functions = odb.GetObjects<Function>(true);
			odb.Close();
			// assertEquals(nbUsers+2,users.size());
			User user2 = (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);
		}
		private object GetUserInstance()
		{
			Function login = new Function
				("login");
			Function logout = new Function
				("logout");
			List list = new System.Collections.ArrayList();
			list.Add(login);
			list.Add(logout);
			Profile profile = new Profile("operator", list);
			User user = new User("olivier smadja"
				, "*****@*****.**", profile);
			return user;
		}
Beispiel #36
0
        public virtual void Test6()
		{
			// LogUtil.objectWriterOn(true);
			DeleteBase("t6.neodatis");
			NeoDatis.Odb.ODB odb = Open("t6.neodatis");
			Function login = new Function
				("login");
			Function logout = new Function
				("logout");
            System.Collections.Generic.List<Function> list = new System.Collections.Generic.List<Function>();
			list.Add(login);
			list.Add(logout);
			Profile profile = new Profile
				("operator", list);
			User olivier = new User("olivier smadja"
				, "*****@*****.**", profile);
			odb.Store(olivier);
			odb.Close();
			Println("----------");
			odb = Open("t6.neodatis");
			NeoDatis.Odb.Objects<User> users = odb.GetObjects<User>(true);
			User u1 = (User)users.GetFirst
				();
			u1.GetProfile().SetName("operator 234567891011121314");
			odb.Store(u1);
			odb.Close();
			odb = Open("t6.neodatis");
			NeoDatis.Odb.Objects<Profile> profiles = odb.GetObjects<Profile>(true);
			AssertEquals(1, profiles.Count);
			Profile p1 = (Profile)profiles
				.GetFirst();
			AssertEquals(u1.GetProfile().GetName(), p1.GetName());
		}
Beispiel #37
0
		/// <exception cref="System.Exception"></exception>
		public virtual void TestComplexInstance()
		{
			DeleteBase("t-complex-instance.neodatis");
			NeoDatis.Odb.ODB odb = Open("t-complex-instance.neodatis");
			Function login = new Function
				("login");
			Function logout = new Function
				("logout");
			List<Function> functions = new List<Function>();
			functions.Add(login);
			functions.Add(logout);
			Profile profile = new Profile("profile1", functions);
			NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("oliver"
				, "*****@*****.**", profile);
            NeoDatis.Odb.Test.VO.Login.User user22 = new NeoDatis.Odb.Test.VO.Login.User("oliver2"
				, "*****@*****.**", profile);
			odb.Store(user);
			odb.Store(user22);
			odb.Close();
			odb = Open("t-complex-instance.neodatis");
			NeoDatis.Odb.Objects<NeoDatis.Odb.Test.VO.Login.User> l = odb.GetObjects<NeoDatis.Odb.Test.VO.Login.User>(true);
            NeoDatis.Odb.Test.VO.Login.User user2 = l.GetFirst();
			// println("#### " + l.size() + " : " + l);
			AssertEquals(user.GetName(), user2.GetName());
			AssertEquals(user.GetEmail(), user2.GetEmail());
			AssertEquals(user.GetProfile().GetName(), user2.GetProfile().GetName());
			AssertEquals(user.GetProfile().GetFunctions()[0].ToString(), user2.GetProfile().GetFunctions
				()[0].ToString());
			odb.Close();
			DeleteBase("t-complex-instance.neodatis");
		}
Beispiel #38
0
			public bool Match(User user)
			{
				return user.GetProfile().GetName().Equals(newName);
			}
Beispiel #39
0
 public bool Match(NeoDatis.Odb.Test.VO.Login.User user)
 {
     return(user.GetProfile().GetName().StartsWith("profile") && user.GetEmail().StartsWith
                ("[email protected] 2"));
 }
Beispiel #40
0
 public bool Match(NeoDatis.Odb.Test.VO.Login.User user)
 {
     return(user.GetProfile().GetName().Equals("profile 5"));
 }
Beispiel #41
0
        public virtual void Test7()
		{
			DeleteBase(FileName);
			NeoDatis.Odb.ODB odb = Open(FileName);
			Function function = new Function
				("login");
			Profile profile = new Profile
				("operator", function);
			User user = new User("olivier smadja"
				, "*****@*****.**", profile);
			odb.Store(user);
			odb.Close();
			odb = Open(FileName);
			User user2 = odb.GetObjects<User>().GetFirst();
			user2.GetProfile().AddFunction(new Function("new Function"
				));
			odb.Store(user2);
			odb.Close();
			odb = Open(FileName);
			User user3 = (User)odb.GetObjects<User>().GetFirst();
			AssertEquals(2, user3.GetProfile().GetFunctions().Count);
			Function f1 = (Function)user3
				.GetProfile().GetFunctions()[0];
			Function f2 = (Function)user3
				.GetProfile().GetFunctions()[1];
			AssertEquals("login", f1.GetName());
			AssertEquals("new Function", f2.GetName());
			odb.Close();
		}
Beispiel #42
0
 public bool Match(NeoDatis.Odb.Test.VO.Login.User user)
 {
     return(user.GetProfile().GetName().StartsWith("profile"));
 }
Beispiel #43
0
        public virtual void Test8()
		{
			DeleteBase(FileName);
			NeoDatis.Odb.ODB odb = Open(FileName);
			Function function = new Function
				("login");
			Profile profile = new Profile
				("operator", function);
			User user = new User("olivier smadja"
				, "*****@*****.**", profile);
			odb.Store(user);
			odb.Close();
			odb = Open(FileName);
			User user2 = (User)odb.GetObjects<User>().GetFirst();
			user2.SetProfile(null);
			odb.Store(user2);
			odb.Close();
			odb = Open(FileName);
			User user3 = (User)odb.GetObjects<User>().GetFirst();
			AssertNull(user3.GetProfile());
			odb.Close();
		}