Esempio n. 1
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();
        }
Esempio n. 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);
 }
Esempio n. 3
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);
		}
Esempio n. 4
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();
		}
Esempio n. 6
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();
        }
Esempio n. 7
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);
        }
Esempio n. 8
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;
		}
Esempio n. 9
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);
 }
Esempio n. 10
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);
        }
Esempio n. 11
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);
        }
Esempio n. 12
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);
		}
Esempio n. 13
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);
 }
Esempio n. 14
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);
		}
Esempio n. 15
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);
		}
Esempio n. 16
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);
		}
Esempio n. 17
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();
		}
Esempio n. 18
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);
		}