Beispiel #1
0
        /// <exception cref="Java.IO.UnsupportedEncodingException"></exception>
        public virtual void Test1()
        {
            NeoDatis.Odb.ODB odb      = null;
            string           baseName = GetBaseName();

            Java.Util.Locale defaultLocale = Java.Util.Locale.GetDefault();
            try
            {
                odb = Open(baseName);
                NeoDatis.Odb.OdbConfiguration.SetLatinDatabaseCharacterEncoding();
                Java.Util.Locale brLocale = new Java.Util.Locale("pt", "BR");
                Java.Util.Locale.SetDefault(brLocale);
                NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                  ();
                tc.SetBigDecimal1(new System.Decimal(5.3));
                Println(tc.GetBigDecimal1().ToString());
                odb.Store(tc);
                odb.Close();
                odb = Open(baseName);
                NeoDatis.Odb.Objects <NeoDatis.Odb.Test.VO.Attribute.TestClass> objects = odb.GetObjects
                                                                                              (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass));
                AssertEquals(1, objects.Count);
                AssertEquals(new System.Decimal(5.3), objects.GetFirst().GetBigDecimal1());
            }
            finally
            {
                if (odb != null && !odb.IsClosed())
                {
                    odb.Close();
                }
                NeoDatis.Odb.OdbConfiguration.SetDatabaseCharacterEncoding(null);
                Java.Util.Locale.SetDefault(defaultLocale);
            }
        }
Beispiel #2
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();
        }
Beispiel #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);
        }
        public virtual void Test1()
		{
			NeoDatis.Tool.IOUtil.DeleteFile("base1.neodatis");
			NeoDatis.Odb.ODB odb = NeoDatis.Odb.ODBFactory.Open("base1.neodatis");
			string[] fields = new string[] { "int1" };
			odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).AddUniqueIndexOn
				("index1", fields, true);
			long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
			int size = 50;
			for (int i = 0; i < size; i++)
			{
				NeoDatis.Odb.Test.VO.Attribute.TestClass testClass = new NeoDatis.Odb.Test.VO.Attribute.TestClass
					();
				testClass.SetBigDecimal1(new System.Decimal(i));
				testClass.SetBoolean1(i % 3 == 0);
				testClass.SetChar1((char)(i % 5));
				testClass.SetDate1(new System.DateTime(start + i));
				testClass.SetDouble1(((double)(i % 10)) / size);
				testClass.SetInt1(size - i);
				testClass.SetString1("test class " + i);
				odb.Store(testClass);
			}
			// println(testClass.getDouble1() + " | " + testClass.getString1() +
			// " | " + testClass.getInt1());
			odb.Close();
		}
Beispiel #5
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);
        }
Beispiel #6
0
        public virtual void Test1()
        {
            NeoDatis.Tool.IOUtil.DeleteFile("base1.neodatis");
            NeoDatis.Odb.ODB odb    = NeoDatis.Odb.ODBFactory.Open("base1.neodatis");
            string[]         fields = new string[] { "int1" };
            odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).AddUniqueIndexOn
                ("index1", fields, true);
            long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            int  size  = 50;

            for (int i = 0; i < size; i++)
            {
                NeoDatis.Odb.Test.VO.Attribute.TestClass testClass = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                         ();
                testClass.SetBigDecimal1(new System.Decimal(i));
                testClass.SetBoolean1(i % 3 == 0);
                testClass.SetChar1((char)(i % 5));
                testClass.SetDate1(new System.DateTime(start + i));
                testClass.SetDouble1(((double)(i % 10)) / size);
                testClass.SetInt1(size - i);
                testClass.SetString1("test class " + i);
                odb.Store(testClass);
            }
            // println(testClass.getDouble1() + " | " + testClass.getString1() +
            // " | " + testClass.getInt1());
            odb.Close();
        }
Beispiel #7
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);
		}
Beispiel #8
0
 /// <exception cref="System.Exception"></exception>
 public virtual void TestStringPersistence()
 {
     NeoDatis.Odb.ODB odb = null;
     try
     {
         odb = Open("date.neodatis");
         NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                            ();
         tc1.SetString1(string.Empty);
         odb.Store(tc1);
         odb.Close();
         odb = Open("date.neodatis");
         NeoDatis.Odb.Objects l = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                        ));
         AssertEquals(1, l.Count);
         NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = (NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                         )l.GetFirst();
         AssertEquals(string.Empty, tc2.GetString1());
         AssertEquals(null, tc2.GetBigDecimal1());
         AssertEquals(null, tc2.GetDouble1());
     }
     finally
     {
         if (odb != null)
         {
             odb.Close();
         }
     }
 }
Beispiel #9
0
 /// <exception cref="System.Exception"></exception>
 public virtual void TestDatePersistence()
 {
     NeoDatis.Odb.ODB odb = null;
     DeleteBase("date.neodatis");
     try
     {
         odb = Open("date.neodatis");
         NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                            ();
         tc1.SetDate1(new System.DateTime());
         long t1 = tc1.GetDate1().Millisecond;
         odb.Store(tc1);
         odb.Close();
         odb = Open("date.neodatis");
         NeoDatis.Odb.Objects l = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                        ));
         AssertEquals(1, l.Count);
         NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = (NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                         )l.GetFirst();
         AssertEquals(t1, tc2.GetDate1().Millisecond);
         AssertEquals(tc1.GetDate1(), tc2.GetDate1());
     }
     finally
     {
         if (odb != null)
         {
             odb.Close();
         }
     }
     DeleteBase("date.neodatis");
 }
Beispiel #10
0
		/// <exception cref="Java.IO.UnsupportedEncodingException"></exception>
		public virtual void Test1()
		{
			NeoDatis.Odb.ODB odb = null;
			string baseName = GetBaseName();
			Java.Util.Locale defaultLocale = Java.Util.Locale.GetDefault();
			try
			{
				odb = Open(baseName);
				NeoDatis.Odb.OdbConfiguration.SetLatinDatabaseCharacterEncoding();
				Java.Util.Locale brLocale = new Java.Util.Locale("pt", "BR");
				Java.Util.Locale.SetDefault(brLocale);
				NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass
					();
				tc.SetBigDecimal1(new System.Decimal(5.3));
				Println(tc.GetBigDecimal1().ToString());
				odb.Store(tc);
				odb.Close();
				odb = Open(baseName);
				NeoDatis.Odb.Objects<NeoDatis.Odb.Test.VO.Attribute.TestClass> objects = odb.GetObjects
					(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass));
				AssertEquals(1, objects.Count);
				AssertEquals(new System.Decimal(5.3), objects.GetFirst().GetBigDecimal1());
			}
			finally
			{
				if (odb != null && !odb.IsClosed())
				{
					odb.Close();
				}
				NeoDatis.Odb.OdbConfiguration.SetDatabaseCharacterEncoding(null);
				Java.Util.Locale.SetDefault(defaultLocale);
			}
		}
Beispiel #11
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);
 }
Beispiel #12
0
 private NeoDatis.Odb.Test.VO.Attribute.TestClass GetTestClassInstance()
 {
     NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                       ();
     tc.SetBigDecimal1(new System.Decimal(1.123456789));
     tc.SetBoolean1(true);
     tc.SetChar1('d');
     tc.SetDouble1(154.78998989);
     tc.SetInt1(78964);
     tc.SetString1("Ola chico como vc est√° ???");
     tc.SetDate1(new System.DateTime());
     return(tc);
 }
Beispiel #13
0
		private NeoDatis.Odb.Test.VO.Attribute.TestClass GetTestClassInstance()
		{
			NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass
				();
			tc.SetBigDecimal1(new System.Decimal(1.123456789));
			tc.SetBoolean1(true);
			tc.SetChar1('d');
			tc.SetDouble1(154.78998989);
			tc.SetInt1(78964);
			tc.SetString1("Ola chico como vc est√° ???");
			tc.SetDate1(new System.DateTime());
			return tc;
		}
Beispiel #14
0
        public virtual void Test7()
        {
            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(i);
                odb.Store(tc1);
            }
            odb.Close();
            odb = Open("valuesA2");
            decimal nb = odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof(
                                                                                               NeoDatis.Odb.Test.VO.Attribute.TestClass), NeoDatis.Odb.Core.Query.Criteria.Where
                                                                                           .Equal("int1", 2)));

            Println(nb);
            odb.Close();
            AssertEquals(1, nb);
        }
Beispiel #15
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);
        }
Beispiel #16
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);
 }
Beispiel #17
0
		/// <exception cref="System.IO.IOException"></exception>
		/// <exception cref="System.Exception"></exception>
		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);
		}
Beispiel #18
0
		/// <exception cref="System.Exception"></exception>
		public virtual void TestDatePersistence()
		{
			NeoDatis.Odb.ODB odb = null;
			DeleteBase("date.neodatis");
			try
			{
				odb = Open("date.neodatis");
				NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
					();
				tc1.SetDate1(new System.DateTime());
				long t1 = tc1.GetDate1().Millisecond;
				odb.Store(tc1);
				odb.Close();
				odb = Open("date.neodatis");
				NeoDatis.Odb.Objects l = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass
					));
				AssertEquals(1, l.Count);
				NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = (NeoDatis.Odb.Test.VO.Attribute.TestClass
					)l.GetFirst();
				AssertEquals(t1, tc2.GetDate1().Millisecond);
				AssertEquals(tc1.GetDate1(), tc2.GetDate1());
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
			}
			DeleteBase("date.neodatis");
		}
Beispiel #19
0
		/// <exception cref="System.Exception"></exception>
		public virtual void TestStringPersistence()
		{
			NeoDatis.Odb.ODB odb = null;
			try
			{
				odb = Open("date.neodatis");
				NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
					();
				tc1.SetString1(string.Empty);
				odb.Store(tc1);
				odb.Close();
				odb = Open("date.neodatis");
				NeoDatis.Odb.Objects l = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass
					));
				AssertEquals(1, l.Count);
				NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = (NeoDatis.Odb.Test.VO.Attribute.TestClass
					)l.GetFirst();
				AssertEquals(string.Empty, tc2.GetString1());
				AssertEquals(null, tc2.GetBigDecimal1());
				AssertEquals(null, tc2.GetDouble1());
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
			}
		}
Beispiel #20
0
		/// <exception cref="System.IO.IOException"></exception>
		/// <exception cref="System.Exception"></exception>
		public virtual void Test7()
		{
			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(i);
				odb.Store(tc1);
			}
			odb.Close();
			odb = Open("valuesA2");
			decimal nb = odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof(
				NeoDatis.Odb.Test.VO.Attribute.TestClass), NeoDatis.Odb.Core.Query.Criteria.Where
				.Equal("int1", 2)));
			Println(nb);
			odb.Close();
			AssertEquals(1, nb);
		}
Beispiel #21
0
		/// <exception cref="System.IO.IOException"></exception>
		/// <exception cref="System.Exception"></exception>
		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);
		}
Beispiel #22
0
		// assertEquals(bsum.divide(new
		// BigDecimal(size),2,BigDecimal.ROUND_HALF_DOWN), avg);
		/// <exception cref="System.IO.IOException"></exception>
		/// <exception cref="System.Exception"></exception>
		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);
		}
Beispiel #23
0
		/// <summary>Custom</summary>
		/// <exception cref="System.IO.IOException"></exception>
		/// <exception cref="System.Exception"></exception>
		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();
		}
Beispiel #24
0
		/// <summary>Min</summary>
		/// <exception cref="System.IO.IOException"></exception>
		/// <exception cref="System.Exception"></exception>
		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);
		}