Exemple #1
0
        public virtual void Test10()
        {
            DeleteBase("valuesA2");
            NeoDatis.Odb.ODB        odb = Open("valuesA2");
            NeoDatis.Tool.StopWatch t   = new NeoDatis.Tool.StopWatch();
            t.Start();
            int  size = 1000;
            long sum  = 0;

            for (int i = 0; i < size; i++)
            {
                NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                   ();
                tc1.SetInt1(i);
                odb.Store(tc1);
                sum += i;
            }
            odb.Close();
            t.End();
            Println(" time for insert = " + t.GetDurationInMiliseconds());
            odb = Open("valuesA2");
            t.Start();
            NeoDatis.Odb.Core.Query.Values.ICustomQueryFieldAction custom = new NeoDatis.Odb.Test.Query.Values.TestCustomQueryFieldAction
                                                                                ();
            NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                           (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).Custom("int1", "custom of int1"
                                                                                                                     , custom));
            t.End();
            NeoDatis.Odb.ObjectValues ov = values.NextValues();
            System.Decimal            c  = (System.Decimal)ov.GetByAlias("custom of int1");
            Println(c);
            Println(" time for count = " + t.GetDurationInMiliseconds());
            odb.Close();
        }
Exemple #2
0
 public virtual void Test1()
 {
     DeleteBase("values2");
     NeoDatis.Odb.ODB odb = Open("values2");
     NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                        ();
     tc1.SetInt1(45);
     odb.Store(tc1);
     NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                        ();
     tc2.SetInt1(45);
     odb.Store(tc2);
     NeoDatis.Odb.Test.VO.Attribute.TestClass tc3 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                        ();
     tc3.SetInt1(46);
     odb.Store(tc3);
     odb.Close();
     odb = Open("values2");
     NeoDatis.Odb.Core.Query.IValuesQuery vq = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                   (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).Sum("int1", "sum of int1").GroupBy
                                                   ("int1");
     vq.OrderByAsc("int1");
     NeoDatis.Odb.Values values = odb.GetValues(vq);
     AssertEquals(2, values.Count);
     Println(values);
     NeoDatis.Odb.ObjectValues ov = values.NextValues();
     AssertEquals(System.Decimal.ValueOf(90), ov.GetByAlias("sum of int1"));
     ov = values.NextValues();
     AssertEquals(System.Decimal.ValueOf(46), ov.GetByAlias("sum of int1"));
     odb.Close();
     AssertEquals(2, values.Count);
 }
Exemple #3
0
        public virtual void Test16()
        {
            DeleteBase("valuesA2");
            NeoDatis.Odb.ODB        odb = null;
            NeoDatis.Tool.StopWatch t   = new NeoDatis.Tool.StopWatch();
            int size = isLocal ? 10000 : 100;

            for (int j = 0; j < 10; j++)
            {
                t.Start();
                odb = Open("valuesA2");
                for (int i = 0; i < size; i++)
                {
                    NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                       ();
                    tc1.SetInt1(45);
                    odb.Store(tc1);
                }
                odb.Close();
                t.End();
                Println(" time for insert = " + t.GetDurationInMiliseconds());
            }
            odb = Open("valuesA2");
            t.Start();
            NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                           (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).Count("nb objects"));
            t.End();
            Println(values);
            Println(" time for count = " + t.GetDurationInMiliseconds());
            NeoDatis.Odb.ObjectValues ov = values.NextValues();
            odb.Close();
            AssertEquals(size * 10, ov.GetByAlias("nb objects"));
            AssertEquals(1, values.Count);
        }
Exemple #4
0
        public virtual void Test9()
        {
            DeleteBase("valuesA2");
            NeoDatis.Odb.ODB odb = Open("valuesA2");
            int  size            = isLocal ? 100000 : 1000;
            long sum             = 0;

            for (int i = 0; i < size; i++)
            {
                NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                   ();
                tc1.SetInt1(i);
                odb.Store(tc1);
                sum += i;
            }
            odb.Close();
            odb = Open("valuesA2");
            NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                           (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).Min("int1", "min of int1").Avg
                                                           ("int1", "avg of int1").Sum("int1", "sum of int1"));
            NeoDatis.Odb.ObjectValues ov   = values.NextValues();
            System.Decimal            min  = (System.Decimal)ov.GetByAlias("min of int1");
            System.Decimal            avg  = (System.Decimal)ov.GetByAlias("avg of int1");
            System.Decimal            bsum = (System.Decimal)ov.GetByAlias("sum of int1");
            Println(min);
            Println(avg);
            Println(bsum);
            odb.Close();
            AssertEquals(new System.Decimal(sum), bsum);
            AssertEquals(new System.Decimal(0), min);
            AssertEquals(bsum / 2, avg);
        }
Exemple #5
0
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="System.Exception"></exception>
        public virtual void Test11()
        {
            NeoDatis.Odb.ODB odb = NeoDatis.Odb.ODBFactory.Open("valuesSubList");
            NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler
                                                                 ();
            for (int i = 0; i < 10; i++)
            {
                handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value "
                                                                                  + i));
            }
            odb.Store(handler);
            odb.Close();
            odb = Open("valuesSubList");
            NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                           (typeof(NeoDatis.Odb.Test.Query.Values.Handler)).Field("parameters").Sublist("parameters"
                                                                                                                                        , "sub1", 1, 5, true).Sublist("parameters", "sub2", 1, 10).Size("parameters", "size"
                                                                                                                                                                                                        ));
            NeoDatis.Odb.ObjectValues ov = values.NextValues();
            // Retrieve Result values
            System.Collections.IList fulllist = (System.Collections.IList)ov.GetByAlias("parameters"
                                                                                        );
            long size = (long)ov.GetByAlias("size");

            System.Collections.IList sublist = (System.Collections.IList)ov.GetByAlias("sub1"
                                                                                       );
            odb.Close();
        }
Exemple #6
0
        public virtual void Test4()
        {
            DeleteBase("sublist4");
            NeoDatis.Odb.ODB odb = Open("sublist4");
            int i = 0;

            System.Collections.IList functions1 = new System.Collections.ArrayList();
            for (i = 0; i < 30; i++)
            {
                functions1.Add(new NeoDatis.Odb.Test.VO.Login.Function("f1-" + i));
            }
            System.Collections.IList functions2 = new System.Collections.ArrayList();
            for (i = 0; i < 60; i++)
            {
                functions2.Add(new NeoDatis.Odb.Test.VO.Login.Function("f2-" + i));
            }
            System.Collections.IList functions3 = new System.Collections.ArrayList();
            for (i = 0; i < 90; i++)
            {
                functions3.Add(new NeoDatis.Odb.Test.VO.Login.Function("f3-" + i));
            }
            NeoDatis.Odb.Test.VO.Login.User user1 = new NeoDatis.Odb.Test.VO.Login.User("User1"
                                                                                        , "*****@*****.**", new NeoDatis.Odb.Test.VO.Login.Profile("profile1", functions1
                                                                                                                                                      ));
            NeoDatis.Odb.Test.VO.Login.User user2 = new NeoDatis.Odb.Test.VO.Login.User("User2"
                                                                                        , "*****@*****.**", new NeoDatis.Odb.Test.VO.Login.Profile("profile2", functions2
                                                                                                                                                      ));
            NeoDatis.Odb.Test.VO.Login.User user3 = new NeoDatis.Odb.Test.VO.Login.User("User3"
                                                                                        , "*****@*****.**", new NeoDatis.Odb.Test.VO.Login.Profile("profile3", functions3
                                                                                                                                                      ));
            odb.Store(user1);
            odb.Store(user2);
            odb.Store(user3);
            odb.Close();
            odb = Open("sublist4");
            NeoDatis.Odb.Test.VO.Login.User u = (NeoDatis.Odb.Test.VO.Login.User)odb.GetObjects
                                                    (typeof(NeoDatis.Odb.Test.VO.Login.User)).GetFirst();
            System.Console.Out.WriteLine(u);
            NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                         (typeof(NeoDatis.Odb.Test.VO.Login.Profile)).Field("name").Sublist("functions",
                                                                                                                            1, 2, false).Size("functions", "fsize");
            NeoDatis.Odb.Values v = odb.GetValues(q);
            i = 0;
            while (v.HasNext())
            {
                NeoDatis.Odb.ObjectValues ov = v.NextValues();
                string profileName           = (string)ov.GetByAlias("name");
                Println(profileName);
                AssertEquals("profile" + (i + 1), profileName);
                AssertEquals(System.Convert.ToInt64(30 * (i + 1)), ov.GetByAlias("fsize"));
                System.Collections.IList l = (System.Collections.IList)ov.GetByAlias("functions");
                Println(l);
                AssertEquals(2, l.Count);
                i++;
            }
            odb.Close();
        }
Exemple #7
0
 public virtual void Test1()
 {
     DeleteBase("valuesA");
     NeoDatis.Odb.ODB odb = Open("valuesA");
     odb.Store(new NeoDatis.Odb.Test.VO.Login.Function("f1"));
     odb.Close();
     odb = Open("valuesA");
     NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                    (typeof(NeoDatis.Odb.Test.VO.Login.Function)).Field("name"));
     Println(values);
     NeoDatis.Odb.ObjectValues ov = values.NextValues();
     odb.Close();
     AssertEquals("f1", ov.GetByAlias("name"));
     AssertEquals("f1", ov.GetByIndex(0));
 }
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="System.Exception"></exception>
        public virtual void Test1()
        {
            string baseName = GetBaseName();

            DeleteBase(baseName);
            NeoDatis.Odb.ODB odb = Open(baseName);
            NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler
                                                                 ();
            for (int i = 0; i < 10; i++)
            {
                handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value "
                                                                                  + i));
            }
            NeoDatis.Odb.OID oid = odb.Store(handler);
            odb.Close();
            odb = Open(baseName);
            NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                           (typeof(NeoDatis.Odb.Test.Query.Values.Handler), oid).Field("parameters").Sublist
                                                           ("parameters", "sub1", 1, 5, true).Sublist("parameters", "sub2", 1, 10).Size("parameters"
                                                                                                                                        , "size"));
            Println(values);
            NeoDatis.Odb.ObjectValues ov       = values.NextValues();
            System.Collections.IList  fulllist = (System.Collections.IList)ov.GetByAlias("parameters"
                                                                                         );
            AssertEquals(10, fulllist.Count);
            long size = (long)ov.GetByAlias("size");

            AssertEquals(10, size);
            NeoDatis.Odb.Test.Query.Values.Parameter p = (NeoDatis.Odb.Test.Query.Values.Parameter
                                                          )fulllist[0];
            AssertEquals("value 0", p.GetValue());
            NeoDatis.Odb.Test.Query.Values.Parameter p2 = (NeoDatis.Odb.Test.Query.Values.Parameter
                                                           )fulllist[9];
            AssertEquals("value 9", p2.GetValue());
            System.Collections.IList sublist = (System.Collections.IList)ov.GetByAlias("sub1"
                                                                                       );
            AssertEquals(5, sublist.Count);
            p = (NeoDatis.Odb.Test.Query.Values.Parameter)sublist[0];
            AssertEquals("value 1", p.GetValue());
            p2 = (NeoDatis.Odb.Test.Query.Values.Parameter)sublist[4];
            AssertEquals("value 5", p2.GetValue());
            System.Collections.IList sublist2 = (System.Collections.IList)ov.GetByAlias("sub2"
                                                                                        );
            AssertEquals(9, sublist2.Count);
            odb.Close();
        }
Exemple #9
0
 public virtual void Test17()
 {
     DeleteBase("valuesA2");
     NeoDatis.Odb.ODB odb = Open("valuesA2");
     odb.Store(new NeoDatis.Odb.Test.VO.Login.User("user1", "email1", new NeoDatis.Odb.Test.VO.Login.Profile
                                                       ("profile name", new NeoDatis.Odb.Test.VO.Login.Function("f111"))));
     odb.Close();
     odb = Open("valuesA2");
     NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                    (typeof(NeoDatis.Odb.Test.VO.Login.User)).Field("name").Field("profile"));
     Println(values);
     NeoDatis.Odb.ObjectValues ov = values.NextValues();
     odb.Close();
     AssertEquals("user1", ov.GetByAlias("name"));
     AssertEquals("user1", ov.GetByIndex(0));
     NeoDatis.Odb.Test.VO.Login.Profile p2 = (NeoDatis.Odb.Test.VO.Login.Profile)ov.GetByAlias
                                                 ("profile");
     AssertEquals("profile name", p2.GetName());
 }
Exemple #10
0
        /// <summary>Using Object representation instead of real object</summary>
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="System.Exception"></exception>
        public virtual void Test5()
        {
            int sublistSize = 400;

            if (!isLocal && !useSameVmOptimization)
            {
                sublistSize = 40;
            }
            string baseName = GetBaseName();

            DeleteBase(baseName);
            NeoDatis.Odb.ODB odb = Open(baseName);
            NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler
                                                                 ();
            for (int i = 0; i < sublistSize; i++)
            {
                handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value "
                                                                                  + i));
            }
            odb.Store(handler);
            odb.Close();
            odb = Open("valuesSubList3");
            long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                         (typeof(NeoDatis.Odb.Test.Query.Values.Handler)).Sublist("parameters", "sub", 0,
                                                                                                                  2, true);
            NeoDatis.Odb.Values values = odb.GetValues(q);
            long end = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            Println("time to load sublist of 5 itens for " + sublistSize + " : " + (end - start
                                                                                    ));
            Println(values);
            NeoDatis.Odb.ObjectValues ov      = values.NextValues();
            System.Collections.IList  sublist = (System.Collections.IList)ov.GetByAlias("sub");
            AssertEquals(2, sublist.Count);
            NeoDatis.Odb.Test.Query.Values.Parameter parameter = (NeoDatis.Odb.Test.Query.Values.Parameter
                                                                  )sublist[1];
            AssertEquals("value 1", parameter.GetValue());
            NeoDatis.Odb.OID oid = odb.GetObjectId(parameter);
            Println(oid);
            odb.Close();
        }
Exemple #11
0
 // This method os not used in Values Query API
 public virtual void ObjectMatch(NeoDatis.Odb.OID oid, object @object, NeoDatis.Tool.Wrappers.OdbComparable
                                 orderByKey)
 {
     if (query.IsMultiRow())
     {
         NeoDatis.Odb.ObjectValues values = ConvertObject((NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
                                                           )@object);
         if (queryHasOrderBy)
         {
             result.AddWithKey(orderByKey, values);
         }
         else
         {
             result.Add(values);
         }
     }
     else
     {
         Compute((NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap)@object);
     }
 }
Exemple #12
0
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="System.Exception"></exception>
        public virtual void Test2()
        {
            DeleteBase("valuesSubList2");
            NeoDatis.Odb.ODB odb = Open("valuesSubList2");
            NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler
                                                                 ();
            for (int i = 0; i < 500; i++)
            {
                handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value "
                                                                                  + i));
            }
            NeoDatis.Odb.OID oid = odb.Store(handler);
            odb.Close();
            odb = Open("valuesSubList2");
            NeoDatis.Odb.Test.Query.Values.Handler h = (NeoDatis.Odb.Test.Query.Values.Handler
                                                        )odb.GetObjectFromId(oid);
            Println("size of list = " + h.GetListOfParameters().Count);
            long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                           (typeof(NeoDatis.Odb.Test.Query.Values.Handler)).Sublist("parameters", "sub", 490
                                                                                                                    , 5, true).Size("parameters", "size"));
            long end = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            Println("time to load sublist of 5 itens from 40000 : " + (end - start));
            Println(values);
            NeoDatis.Odb.ObjectValues ov      = values.NextValues();
            System.Collections.IList  sublist = (System.Collections.IList)ov.GetByAlias("sub");
            AssertEquals(5, sublist.Count);
            long size = (long)ov.GetByAlias("size");

            AssertEquals(500, size);
            NeoDatis.Odb.Test.Query.Values.Parameter p = (NeoDatis.Odb.Test.Query.Values.Parameter
                                                          )sublist[0];
            AssertEquals("value 490", p.GetValue());
            NeoDatis.Odb.Test.Query.Values.Parameter p2 = (NeoDatis.Odb.Test.Query.Values.Parameter
                                                           )sublist[4];
            AssertEquals("value 494", p2.GetValue());
            odb.Close();
        }
Exemple #13
0
 public virtual void Test3()
 {
     DeleteBase("values2");
     NeoDatis.Odb.ODB odb = Open("values2");
     NeoDatis.Odb.Test.VO.Login.Profile p1 = new NeoDatis.Odb.Test.VO.Login.Profile("profile1"
                                                                                    , new NeoDatis.Odb.Test.VO.Login.Function("f1"));
     NeoDatis.Odb.Test.VO.Login.Profile p2 = new NeoDatis.Odb.Test.VO.Login.Profile("profile2"
                                                                                    , new NeoDatis.Odb.Test.VO.Login.Function("f2"));
     NeoDatis.Odb.Test.VO.Login.User u1 = new NeoDatis.Odb.Test.VO.Login.User2("user1"
                                                                               , "*****@*****.**", p1, 1);
     NeoDatis.Odb.Test.VO.Login.User u2 = new NeoDatis.Odb.Test.VO.Login.User2("user2"
                                                                               , "*****@*****.**", p1, 2);
     NeoDatis.Odb.Test.VO.Login.User u3 = new NeoDatis.Odb.Test.VO.Login.User2("user3"
                                                                               , "*****@*****.**", p1, 3);
     NeoDatis.Odb.Test.VO.Login.User u4 = new NeoDatis.Odb.Test.VO.Login.User2("user4"
                                                                               , "*****@*****.**", p2, 4);
     NeoDatis.Odb.Test.VO.Login.User u5 = new NeoDatis.Odb.Test.VO.Login.User2("user5"
                                                                               , "*****@*****.**", p2, 5);
     odb.Store(u1);
     odb.Store(u2);
     odb.Store(u3);
     odb.Store(u4);
     odb.Store(u5);
     odb.Close();
     odb = Open("values2");
     NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                  (typeof(NeoDatis.Odb.Test.VO.Login.User2)).Field("profile.name").Count("count").
                                              Avg("nbLogins", "avg").GroupBy("profile.name");
     q.OrderByAsc("name");
     NeoDatis.Odb.Values values = odb.GetValues(q);
     Println(values);
     NeoDatis.Odb.ObjectValues ov = values.NextValues();
     AssertEquals(2, values.Count);
     AssertEquals("profile1", ov.GetByAlias("profile.name"));
     AssertEquals(new System.Decimal("3"), ov.GetByAlias("count"));
     AssertEquals(new System.Decimal("2.00"), ov.GetByAlias("avg"));
     odb.Close();
     AssertEquals(2, values.Count);
 }
Exemple #14
0
        /// <summary>Using Object representation instead of real object</summary>
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="System.Exception"></exception>
        public virtual void Test3()
        {
            int sublistSize = 10000;

            DeleteBase("valuesSubList3");
            NeoDatis.Odb.ODB odb = Open("valuesSubList3");
            NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler
                                                                 ();
            for (int i = 0; i < sublistSize; i++)
            {
                handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value "
                                                                                  + i));
            }
            odb.Store(handler);
            odb.Close();
            odb = Open("valuesSubList3");
            long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                         (typeof(NeoDatis.Odb.Test.Query.Values.Handler)).Sublist("parameters", "sub", 9990
                                                                                                                  , 5, true);
            q.SetReturnInstance(false);
            NeoDatis.Odb.Values values = odb.GetValues(q);
            long end = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            Println("time to load sublist of 5 itens from 40000 : " + (end - start));
            Println(values);
            NeoDatis.Odb.ObjectValues ov      = values.NextValues();
            System.Collections.IList  sublist = (System.Collections.IList)ov.GetByAlias("sub");
            AssertEquals(5, sublist.Count);
            NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                             )sublist[0];
            AssertEquals("value 9990", nnoi.GetValueOf("value"));
            NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi2 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                              )sublist[4];
            AssertEquals("value 9994", nnoi2.GetValueOf("value"));
            odb.Close();
        }
Exemple #15
0
 /// <exception cref="System.IO.IOException"></exception>
 /// <exception cref="System.Exception"></exception>
 public virtual void Test1()
 {
     DeleteBase("valuesA1");
     NeoDatis.Odb.ODB odb = Open("valuesA1");
     NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler
                                                          ();
     for (int i = 0; i < 10; i++)
     {
         handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value"
                                                                           + i));
     }
     odb.Store(handler);
     odb.Close();
     odb = Open("valuesA1");
     NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                    (typeof(NeoDatis.Odb.Test.Query.Values.Handler)).Field("parameters"));
     Println(values);
     NeoDatis.Odb.ObjectValues ov = values.NextValues();
     System.Collections.IList  l  = (System.Collections.IList)ov.GetByAlias("parameters"
                                                                            );
     AssertEquals(10, l.Count);
     odb.Close();
 }
Exemple #16
0
        public virtual void Test5()
        {
            DeleteBase("valuesA2");
            NeoDatis.Odb.ODB odb = Open("valuesA2");
            int size             = isLocal ? 100000 : 1000;

            for (int i = 0; i < size; i++)
            {
                NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                   ();
                tc1.SetInt1(45);
                odb.Store(tc1);
            }
            odb.Close();
            odb = Open("valuesA2");
            NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                           (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).Count("nb objects"));
            Println(values);
            NeoDatis.Odb.ObjectValues ov = values.NextValues();
            odb.Close();
            AssertEquals(size, ov.GetByAlias("nb objects"));
            AssertEquals(1, values.Count);
        }
Exemple #17
0
 public virtual void Test4()
 {
     DeleteBase("valuesA2");
     NeoDatis.Odb.ODB odb = Open("valuesA2");
     NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                        ();
     tc1.SetInt1(45);
     odb.Store(tc1);
     NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                        ();
     tc2.SetInt1(5);
     odb.Store(tc2);
     odb.Close();
     odb = Open("valuesA2");
     NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                    (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).Sum("int1", "sum of int1").Count
                                                    ("nb objects"));
     Println(values);
     NeoDatis.Odb.ObjectValues ov = values.NextValues();
     odb.Close();
     AssertEquals(50, ov.GetByAlias("sum of int1"));
     AssertEquals(2, ov.GetByAlias("nb objects"));
     AssertEquals(1, values.Count);
 }