Ejemplo n.º 1
0
		/// <exception cref="System.Exception"></exception>
		public virtual void Conc(IExtObjectContainer oc)
		{
			IObjectSet os = oc.Query(typeof(InvalidUUIDTestCase));
			if (os.Count == 0)
			{
				// already deleted by other threads
				return;
			}
			Assert.AreEqual(1, os.Count);
			InvalidUUIDTestCase iu = (InvalidUUIDTestCase)os.Next();
			Db4oUUID myUuid = oc.GetObjectInfo(iu).GetUUID();
			Assert.IsNotNull(myUuid);
			byte[] mySignature = myUuid.GetSignaturePart();
			long myLong = myUuid.GetLongPart();
			long unknownLong = long.MaxValue - 100;
			byte[] unknownSignature = new byte[] { 1, 2, 4, 99, 33, 22 };
			Db4oUUID unknownLongPart = new Db4oUUID(unknownLong, mySignature);
			Db4oUUID unknownSignaturePart = new Db4oUUID(myLong, unknownSignature);
			Db4oUUID unknownBoth = new Db4oUUID(unknownLong, unknownSignature);
			Assert.IsNull(oc.GetByUUID(unknownLongPart));
			Assert.IsNull(oc.GetByUUID(unknownSignaturePart));
			Assert.IsNull(oc.GetByUUID(unknownBoth));
			Assert.IsNull(oc.GetByUUID(unknownLongPart));
			Thread.Sleep(500);
			oc.Delete(iu);
			oc.Commit();
			Assert.IsNull(oc.GetByUUID(myUuid));
		}
Ejemplo n.º 2
0
		public virtual void Conc(IExtObjectContainer oc)
		{
			IsStoredTestCase isStored = new IsStoredTestCase();
			isStored.myString = "isStored";
			oc.Store(isStored);
			Assert.IsTrue(oc.IsStored(isStored));
			oc.Commit();
			oc.Delete(isStored);
			Assert.IsFalse(oc.IsStored(isStored));
			oc.Rollback();
			Assert.IsTrue(oc.IsStored(isStored));
			oc.Delete(isStored);
			Assert.IsFalse(oc.IsStored(isStored));
			oc.Commit();
			Assert.IsFalse(oc.IsStored(isStored));
		}
 private Collection4 CommitCapturingUpdatedObjects(IExtObjectContainer container)
 {
     var updated = new Collection4();
     EventRegistryFor(container).Updated += new _IEventListener4_51(updated).OnEvent;
     container.Commit();
     return updated;
 }
Ejemplo n.º 4
0
		public void SetUp()
		{
			_FilePath = Path.GetTempFileName();
			_db = Db4oFactory.OpenFile(_FilePath).Ext();

			TestClass testClass = new TestClass();
			testClass.Label = "Meal times";
			testClass.Times = new List<Time>();
			testClass.Times.Add(new Time(7, 30));
			testClass.Times.Add(new Time(12, 0));
			testClass.Times.Add(new Time(17, 20));
			_db.Set(testClass, 5);

			testClass = new TestClass();
			testClass.Label = "Free time";
			testClass.Times = new List<Time>();
			_db.Set(testClass, 5);

			testClass = new TestClass();
			testClass.Label = "Bed time";
			testClass.Times = new List<Time>();
			testClass.Times.Add(new Time(21, 30));
			_db.Set(testClass, 5);

			_db.Commit();
		}
		private Collection4 CommitCapturingUpdatedObjects(IExtObjectContainer container)
		{
			Collection4 updated = new Collection4();
			EventRegistryFor(container).Updated += new System.EventHandler<Db4objects.Db4o.Events.ObjectInfoEventArgs>
				(new _IEventListener4_51(updated).OnEvent);
			container.Commit();
			return updated;
		}
Ejemplo n.º 6
0
        public virtual void TestSRDC()
        {
            IExtObjectContainer oc1 = OpenNewSession();
            IExtObjectContainer oc2 = OpenNewSession();
            IExtObjectContainer oc3 = OpenNewSession();

            try
            {
                SimpleObject o1 = (SimpleObject)((SimpleObject)RetrieveOnlyInstance(oc1, typeof(SimpleObject
                                                                                                )));
                oc1.Store(o1);
                SimpleObject o2 = (SimpleObject)((SimpleObject)RetrieveOnlyInstance(oc2, typeof(SimpleObject
                                                                                                )));
                Assert.AreEqual("hello", o2.GetS());
                oc1.Rollback();
                o2 = (SimpleObject)((SimpleObject)RetrieveOnlyInstance(oc2, typeof(SimpleObject))
                                    );
                oc2.Refresh(o2, int.MaxValue);
                Assert.AreEqual("hello", o2.GetS());
                oc1.Commit();
                o2 = (SimpleObject)((SimpleObject)RetrieveOnlyInstance(oc2, typeof(SimpleObject))
                                    );
                oc2.Refresh(o2, int.MaxValue);
                Assert.AreEqual("hello", o2.GetS());
                oc1.Delete(o1);
                oc1.Commit();
                AssertOccurrences(oc3, typeof(SimpleObject), 0);
                AssertOccurrences(oc2, typeof(SimpleObject), 0);
            }
            finally
            {
                oc1.Close();
                oc2.Close();
                oc3.Close();
            }
        }
Ejemplo n.º 7
0
        public virtual void TestTransactionalInstanceCount()
        {
            if (!IsMultiSession())
            {
                return;
            }
            IExtObjectContainer otherClient = OpenNewSession();

            Store(new StoredClassInstanceCountTestCase.ItemA());
            DeleteAll(typeof(StoredClassInstanceCountTestCase.ItemB));
            AssertInstanceCount(Db(), typeof(StoredClassInstanceCountTestCase.ItemA), CountA
                                + 1);
            AssertInstanceCount(Db(), typeof(StoredClassInstanceCountTestCase.ItemB), 0);
            AssertInstanceCount(otherClient, typeof(StoredClassInstanceCountTestCase.ItemA),
                                CountA);
            AssertInstanceCount(otherClient, typeof(StoredClassInstanceCountTestCase.ItemB),
                                1);
            Db().Commit();
            AssertInstanceCount(Db(), typeof(StoredClassInstanceCountTestCase.ItemA), CountA
                                + 1);
            AssertInstanceCount(Db(), typeof(StoredClassInstanceCountTestCase.ItemB), 0);
            AssertInstanceCount(otherClient, typeof(StoredClassInstanceCountTestCase.ItemA),
                                CountA + 1);
            AssertInstanceCount(otherClient, typeof(StoredClassInstanceCountTestCase.ItemB),
                                0);
            otherClient.Commit();
            otherClient.Store(new StoredClassInstanceCountTestCase.ItemB());
            AssertInstanceCount(Db(), typeof(StoredClassInstanceCountTestCase.ItemB), 0);
            AssertInstanceCount(otherClient, typeof(StoredClassInstanceCountTestCase.ItemB),
                                1);
            otherClient.Commit();
            AssertInstanceCount(Db(), typeof(StoredClassInstanceCountTestCase.ItemB), 1);
            AssertInstanceCount(otherClient, typeof(StoredClassInstanceCountTestCase.ItemB),
                                1);
            otherClient.Close();
        }
        public virtual void Test()
        {
            IExtObjectContainer oc1 = OpenNewSession();
            IExtObjectContainer oc2 = OpenNewSession();
            IExtObjectContainer oc3 = OpenNewSession();

            try
            {
                IQuery query1 = oc1.Query();
                query1.Descend("name").Constrain("root");
                IObjectSet os1 = query1.Execute();
                Assert.AreEqual(1, os1.Count);
                Atom o1 = (Atom)os1.Next();
                o1.child.child.name = "o1";
                oc1.Store(o1);
                IQuery query2 = oc2.Query();
                query2.Descend("name").Constrain("root");
                IObjectSet os2 = query2.Execute();
                Assert.AreEqual(1, os2.Count);
                Atom o2 = (Atom)os2.Next();
                Assert.AreEqual("child.child", o2.child.child.name);
                oc1.Rollback();
                oc2.Purge(o2);
                os2 = query2.Execute();
                Assert.AreEqual(1, os2.Count);
                o2 = (Atom)os2.Next();
                Assert.AreEqual("child.child", o2.child.child.name);
                oc1.Store(o1);
                oc1.Commit();
                os2 = query2.Execute();
                Assert.AreEqual(1, os2.Count);
                o2 = (Atom)os2.Next();
                oc2.Refresh(o2, int.MaxValue);
                Assert.AreEqual("o1", o2.child.child.name);
                IQuery query3 = oc3.Query();
                query3.Descend("name").Constrain("root");
                IObjectSet os3 = query1.Execute();
                Assert.AreEqual(1, os3.Count);
                Atom o3 = (Atom)os3.Next();
                Assert.AreEqual("o1", o3.child.child.name);
            }
            finally
            {
                oc1.Close();
                oc2.Close();
                oc3.Close();
            }
        }
Ejemplo n.º 9
0
        /// <exception cref="System.Exception"></exception>
        public virtual void Test()
        {
            IExtObjectContainer oc1 = OpenNewSession();
            IExtObjectContainer oc2 = OpenNewSession();
            IExtObjectContainer oc3 = OpenNewSession();

            DeepSetClientServerTestCase.Item example = new DeepSetClientServerTestCase.Item();
            example.name = "1";
            try
            {
                DeepSetClientServerTestCase.Item item1 = (DeepSetClientServerTestCase.Item)oc1.QueryByExample
                                                             (example).Next();
                Assert.AreEqual("1", item1.name);
                Assert.AreEqual("2", item1.child.name);
                Assert.AreEqual("3", item1.child.child.name);
                DeepSetClientServerTestCase.Item item2 = (DeepSetClientServerTestCase.Item)oc2.QueryByExample
                                                             (example).Next();
                Assert.AreEqual("1", item2.name);
                Assert.AreEqual("2", item2.child.name);
                Assert.AreEqual("3", item2.child.child.name);
                item1.child.name       = "12";
                item1.child.child.name = "13";
                oc1.Store(item1, 2);
                oc1.Commit();
                // check result
                DeepSetClientServerTestCase.Item item = (DeepSetClientServerTestCase.Item)oc1.QueryByExample
                                                            (example).Next();
                Assert.AreEqual("1", item.name);
                Assert.AreEqual("12", item.child.name);
                Assert.AreEqual("13", item.child.child.name);
                item = (DeepSetClientServerTestCase.Item)oc2.QueryByExample(example).Next();
                oc2.Refresh(item, 3);
                Assert.AreEqual("1", item.name);
                Assert.AreEqual("12", item.child.name);
                Assert.AreEqual("3", item.child.child.name);
                item = (DeepSetClientServerTestCase.Item)oc3.QueryByExample(example).Next();
                Assert.AreEqual("1", item.name);
                Assert.AreEqual("12", item.child.name);
                Assert.AreEqual("3", item.child.child.name);
            }
            finally
            {
                oc1.Close();
                oc2.Close();
                oc3.Close();
            }
        }
        public virtual void TestRepeatedStore()
        {
            IExtObjectContainer client1 = Db();
            IExtObjectContainer client2 = OpenNewSession();

            CsCascadedDeleteReaddChildReferenceTestCase.ItemParent parent1 = ((CsCascadedDeleteReaddChildReferenceTestCase.ItemParent
                                                                               )RetrieveOnlyInstance(client1, typeof(CsCascadedDeleteReaddChildReferenceTestCase.ItemParent
                                                                                                                     )));
            CsCascadedDeleteReaddChildReferenceTestCase.ItemParent parent2 = ((CsCascadedDeleteReaddChildReferenceTestCase.ItemParent
                                                                               )RetrieveOnlyInstance(client2, typeof(CsCascadedDeleteReaddChildReferenceTestCase.ItemParent
                                                                                                                     )));
            client1.Ext().Store(parent1, int.MaxValue);
            client1.Commit();
            client2.Ext().Store(parent2, int.MaxValue);
            client2.Commit();
            client2.Close();
            AssertInstanceCountAndFieldIndexes(client1);
        }
Ejemplo n.º 11
0
        public virtual void Conc(IExtObjectContainer oc)
        {
            var em = new ExtMethodsTestCase();

            oc.Store(em);
            Assert.IsFalse(oc.IsClosed());
            Assert.IsTrue(oc.IsActive(em));
            Assert.IsTrue(oc.IsStored(em));
            oc.Deactivate(em, 1);
            Assert.IsTrue(!oc.IsActive(em));
            oc.Activate(em, 1);
            Assert.IsTrue(oc.IsActive(em));
            var id = oc.GetID(em);

            Assert.IsTrue(oc.IsCached(id));
            oc.Purge(em);
            Assert.IsFalse(oc.IsCached(id));
            Assert.IsFalse(oc.IsStored(em));
            Assert.IsFalse(oc.IsActive(em));
            oc.Bind(em, id);
            Assert.IsTrue(oc.IsCached(id));
            Assert.IsTrue(oc.IsStored(em));
            Assert.IsTrue(oc.IsActive(em));
            var em2 = (ExtMethodsTestCase)oc.GetByID(id);

            Assert.AreSame(em, em2);
            // Purge all and try again
            oc.Purge();
            Assert.IsTrue(oc.IsCached(id));
            Assert.IsTrue(oc.IsStored(em));
            Assert.IsTrue(oc.IsActive(em));
            em2 = (ExtMethodsTestCase)oc.GetByID(id);
            Assert.AreSame(em, em2);
            oc.Delete(em2);
            oc.Commit();
            Assert.IsFalse(oc.IsCached(id));
            Assert.IsFalse(oc.IsStored(em2));
            Assert.IsFalse(oc.IsActive(em2));
            // Null checks
            Assert.IsFalse(oc.IsStored(null));
            Assert.IsFalse(oc.IsActive(null));
            Assert.IsFalse(oc.IsCached(0));
        }
Ejemplo n.º 12
0
		public virtual void Conc(IExtObjectContainer oc)
		{
			ExtMethodsTestCase em = new ExtMethodsTestCase();
			oc.Store(em);
			Assert.IsFalse(oc.IsClosed());
			Assert.IsTrue(oc.IsActive(em));
			Assert.IsTrue(oc.IsStored(em));
			oc.Deactivate(em, 1);
			Assert.IsTrue(!oc.IsActive(em));
			oc.Activate(em, 1);
			Assert.IsTrue(oc.IsActive(em));
			long id = oc.GetID(em);
			Assert.IsTrue(oc.IsCached(id));
			oc.Purge(em);
			Assert.IsFalse(oc.IsCached(id));
			Assert.IsFalse(oc.IsStored(em));
			Assert.IsFalse(oc.IsActive(em));
			oc.Bind(em, id);
			Assert.IsTrue(oc.IsCached(id));
			Assert.IsTrue(oc.IsStored(em));
			Assert.IsTrue(oc.IsActive(em));
			ExtMethodsTestCase em2 = (ExtMethodsTestCase)oc.GetByID(id);
			Assert.AreSame(em, em2);
			// Purge all and try again
			oc.Purge();
			Assert.IsTrue(oc.IsCached(id));
			Assert.IsTrue(oc.IsStored(em));
			Assert.IsTrue(oc.IsActive(em));
			em2 = (ExtMethodsTestCase)oc.GetByID(id);
			Assert.AreSame(em, em2);
			oc.Delete(em2);
			oc.Commit();
			Assert.IsFalse(oc.IsCached(id));
			Assert.IsFalse(oc.IsStored(em2));
			Assert.IsFalse(oc.IsActive(em2));
			// Null checks
			Assert.IsFalse(oc.IsStored(null));
			Assert.IsFalse(oc.IsActive(null));
			Assert.IsFalse(oc.IsCached(0));
		}
Ejemplo n.º 13
0
 /// <exception cref="System.Exception"></exception>
 public virtual void ConcDelete(IExtObjectContainer oc)
 {
     var os = oc.Query(typeof (Item));
     if (os.Count == 0)
     {
         // the object has been deleted
         return;
     }
     if (!os.HasNext())
     {
         // object can be deleted after query 
         return;
     }
     var cdf = (Item) os.Next();
     // sleep 1000 ms, waiting for other threads.
     // Thread.sleep(500);
     oc.Delete(cdf);
     oc.Commit();
     AssertOccurrences(oc, typeof (Item), 0);
     AssertOccurrences(oc, typeof (CascadeDeleteFalseHelper)
         , 1);
 }
Ejemplo n.º 14
0
		/// <exception cref="System.Exception"></exception>
		public virtual void Conc(IExtObjectContainer oc)
		{
			IQuery q = oc.Query();
			q.Constrain(typeof(MultiDeleteTestCase));
			q.Descend("name").Constrain("killmefirst");
			IObjectSet objectSet = q.Execute();
			if (objectSet.Count == 0)
			{
				// already deleted by other threads
				return;
			}
			Assert.AreEqual(1, objectSet.Count);
			Thread.Sleep(1000);
			if (!objectSet.HasNext())
			{
				return;
			}
			MultiDeleteTestCase md = (MultiDeleteTestCase)objectSet.Next();
			oc.Delete(md);
			oc.Commit();
			AssertOccurrences(oc, typeof(MultiDeleteTestCase), 0);
		}
        public virtual void _testDS()
        {
            IExtObjectContainer oc1 = OpenNewSession();
            IExtObjectContainer oc2 = OpenNewSession();
            IExtObjectContainer oc3 = OpenNewSession();

            try
            {
                SimpleObject o1 = (SimpleObject)((SimpleObject)RetrieveOnlyInstance(oc1, typeof(SimpleObject
                                                                                                )));
                oc1.Delete(o1);
                SimpleObject o2 = (SimpleObject)((SimpleObject)RetrieveOnlyInstance(oc2, typeof(SimpleObject
                                                                                                )));
                Assert.AreEqual("hello", o2.GetS());
                o2.SetS("o2");
                oc2.Store(o2);
                oc1.Commit();
                oc2.Commit();
                o1 = (SimpleObject)((SimpleObject)RetrieveOnlyInstance(oc1, typeof(SimpleObject))
                                    );
                oc1.Refresh(o1, int.MaxValue);
                Assert.AreEqual("o2", o1.GetS());
                o2 = (SimpleObject)((SimpleObject)RetrieveOnlyInstance(oc2, typeof(SimpleObject))
                                    );
                oc2.Refresh(o2, int.MaxValue);
                Assert.AreEqual("o2", o2.GetS());
                SimpleObject o3 = (SimpleObject)((SimpleObject)RetrieveOnlyInstance(oc3, typeof(SimpleObject
                                                                                                )));
                oc1.Refresh(o1, int.MaxValue);
                Assert.AreEqual("o2", o3.GetS());
            }
            finally
            {
                oc1.Close();
                oc2.Close();
                oc3.Close();
            }
        }
Ejemplo n.º 16
0
        /// <exception cref="System.Exception"></exception>
        public virtual void ConcDelete(IExtObjectContainer oc)
        {
            IObjectSet os = oc.Query(typeof(CascadeDeleteFalseTestCase.Item));

            if (os.Count == 0)
            {
                // the object has been deleted
                return;
            }
            if (!os.HasNext())
            {
                // object can be deleted after query
                return;
            }
            CascadeDeleteFalseTestCase.Item cdf = (CascadeDeleteFalseTestCase.Item)os.Next();
            // sleep 1000 ms, waiting for other threads.
            // Thread.sleep(500);
            oc.Delete(cdf);
            oc.Commit();
            AssertOccurrences(oc, typeof(CascadeDeleteFalseTestCase.Item), 0);
            AssertOccurrences(oc, typeof(CascadeDeleteFalseTestCase.CascadeDeleteFalseHelper)
                              , 1);
        }
Ejemplo n.º 17
0
		/// <exception cref="System.Exception"></exception>
		public virtual void Conc(IExtObjectContainer oc)
		{
			IQuery q = oc.Query();
			q.Constrain(typeof(DeleteDeepTestCase));
			q.Descend("name").Constrain("root");
			IObjectSet os = q.Execute();
			if (os.Count == 0)
			{
				// already deleted
				return;
			}
			Assert.AreEqual(1, os.Count);
			if (!os.HasNext())
			{
				return;
			}
			DeleteDeepTestCase root = (DeleteDeepTestCase)os.Next();
			// wait for other threads
			// Thread.sleep(500);
			oc.Delete(root);
			oc.Commit();
			AssertOccurrences(oc, typeof(DeleteDeepTestCase), 0);
		}
        public virtual void TestDeleteReadd()
        {
            IExtObjectContainer client1 = Db();
            IExtObjectContainer client2 = OpenNewSession();

            CsDeleteReaddTestCase.Item item1 = (CsDeleteReaddTestCase.Item)((CsDeleteReaddTestCase.Item
                                                                             )RetrieveOnlyInstance(client1, typeof(CsDeleteReaddTestCase.Item)));
            CsDeleteReaddTestCase.Item item2 = (CsDeleteReaddTestCase.Item)((CsDeleteReaddTestCase.Item
                                                                             )RetrieveOnlyInstance(client2, typeof(CsDeleteReaddTestCase.Item)));
            long idBeforeDelete = client1.GetID(item1);

            client1.Delete(item1);
            client1.Commit();
            client2.Store(item2);
            client2.Commit();
            client2.Close();
            CsDeleteReaddTestCase.Item item3 = ((CsDeleteReaddTestCase.Item)RetrieveOnlyInstance
                                                    (client1, typeof(CsDeleteReaddTestCase.Item)));
            long idAfterUpdate = client1.GetID(item3);

            Assert.AreEqual(idBeforeDelete, idAfterUpdate);
            new FieldIndexAssert(typeof(CsDeleteReaddTestCase.Item), "name").AssertSingleEntry
                (FileSession(), idAfterUpdate);
        }
Ejemplo n.º 19
0
 private void TMembersFirst(IExtObjectContainer oc, string name)
 {
     var commit = name.IndexOf("commit") > 1;
     var q = oc.Query();
     q.Constrain(typeof (Item));
     q.Descend("name").Constrain(name);
     var objectSet = q.Execute();
     var cdd = (Item) objectSet
         .Next();
     oc.Delete(cdd.untypedMember);
     oc.Delete(cdd.typedMember);
     if (commit)
     {
         oc.Commit();
     }
     oc.Delete(cdd);
     if (!commit)
     {
         oc.Commit();
     }
 }
Ejemplo n.º 20
0
        public virtual void TestRefresh()
        {
            IExtObjectContainer client1 = OpenNewSession();
            IExtObjectContainer client2 = OpenNewSession();

            MixedTARefreshTestCase.Item item1 = RetrieveInstance(client1);
            MixedTARefreshTestCase.Item item2 = RetrieveInstance(client2);
            MixedTARefreshTestCase.Item next1 = item1;
            int value = 10;

            while (next1 != null)
            {
                Assert.AreEqual(value, next1.GetValue());
                next1 = next1.Next();
                value--;
            }
            MixedTARefreshTestCase.Item next2 = item2;
            value = 10;
            while (next2 != null)
            {
                Assert.AreEqual(value, next2.GetValue());
                next2 = next2.Next();
                value--;
            }
            item1.SetValue(100);
            item1.Next().SetValue(200);
            client1.Store(item1, 2);
            client1.Commit();
            Assert.AreEqual(100, item1.GetValue());
            Assert.AreEqual(200, item1.Next().GetValue());
            Assert.AreEqual(10, item2.GetValue());
            Assert.AreEqual(9, item2.Next().GetValue());
            //refresh 0
            client2.Refresh(item2, 0);
            Assert.AreEqual(10, item2.GetValue());
            Assert.AreEqual(9, item2.Next().GetValue());
            //refresh 1
            client2.Refresh(item2, 1);
            Assert.AreEqual(100, item2.GetValue());
            Assert.AreEqual(9, item2.Next().GetValue());
            //refresh 2
            client2.Refresh(item2, 2);
            Assert.AreEqual(100, item2.GetValue());
            //FIXME: maybe a bug
            //Assert.areEqual(200, item2.next().getValue());
            next1 = item1;
            value = 1000;
            while (next1 != null)
            {
                next1.SetValue(value);
                next1 = next1.Next();
                value++;
            }
            client1.Store(item1, 5);
            client1.Commit();
            client2.Refresh(item2, 5);
            next2 = item2;
            for (int i = 1000; i < 1005; i++)
            {
                Assert.AreEqual(i, next2.GetValue());
                next2 = next2.Next();
            }
            client1.Close();
            client2.Close();
        }
Ejemplo n.º 21
0
        public virtual void TestRefresh()
        {
            IExtObjectContainer client1 = OpenNewSession();
            IExtObjectContainer client2 = OpenNewSession();

            TARefreshTestCase.TAItem item1 = QueryRoot(client1);
            TARefreshTestCase.TAItem item2 = QueryRoot(client2);
            TARefreshTestCase.TAItem next1 = item1;
            int value = 10;

            while (next1 != null)
            {
                Assert.AreEqual(value, next1.Value());
                next1 = next1.Next();
                value--;
            }
            TARefreshTestCase.TAItem next2 = item2;
            value = 10;
            while (next2 != null)
            {
                Assert.AreEqual(value, next2.Value());
                next2 = next2.Next();
                value--;
            }
            //update depth = 1
            item1.Value(100);
            item1.Next().Value(200);
            client1.Store(item1, 2);
            client1.Commit();
            AssertItemValue(100, item1);
            AssertItemValue(200, item1.Next());
            AssertItemValue(10, item2);
            AssertItemValue(9, item2.Next());
            //refresh 0
            client2.Refresh(item2, 0);
            AssertItemValue(10, item2);
            AssertItemValue(9, item2.Next());
            //refresh 1
            client2.Refresh(item2, 1);
            AssertItemValue(100, item2);
            AssertItemValue(9, item2.Next());
            //refresh 2
            client2.Refresh(item2, 2);
            AssertItemValue(100, item2);
            AssertItemValue(200, item2.Next());
            next1 = item1;
            value = 1000;
            while (next1 != null)
            {
                next1.Value(value);
                next1 = next1.Next();
                value++;
            }
            client1.Store(item1, 5);
            client1.Commit();
            client2.Refresh(item2, 5);
            next2 = item2;
            for (int i = 1000; i < 1005; i++)
            {
                AssertItemValue(i, next2);
                next2 = next2.Next();
            }
            client1.Close();
            client2.Close();
        }
Ejemplo n.º 22
0
 private void TTwoRef(IExtObjectContainer oc, string name)
 {
     var commit = name.IndexOf("commit") > 1;
     var delete = name.IndexOf("delete") > 1;
     var q = oc.Query();
     q.Constrain(typeof (Item));
     q.Descend("name").Constrain(name);
     var objectSet = q.Execute();
     var item1 = (Item) objectSet
         .Next();
     var item2 = (Item) objectSet
         .Next();
     if (delete)
     {
         oc.Delete(item1.untypedMember);
         oc.Delete(item1.typedMember);
     }
     oc.Delete(item1);
     if (commit)
     {
         oc.Commit();
     }
     oc.Delete(item2);
     if (!commit)
     {
         oc.Commit();
     }
 }
 private static void EnsureMessageProcessed(IExtObjectContainer client)
 {
     client.Commit();
 }
		protected override void Update(IExtObjectContainer objectContainer)
		{
			objectContainer.Store(NewItem(2004, 2, 23));
			objectContainer.Commit();
		}
		private void TTwoRef(IExtObjectContainer oc, string name)
		{
			bool commit = name.IndexOf("commit") > 1;
			bool delete = name.IndexOf("delete") > 1;
			IQuery q = oc.Query();
			q.Constrain(typeof(CascadeDeleteDeletedTestCase.Item));
			q.Descend("name").Constrain(name);
			IObjectSet objectSet = q.Execute();
			CascadeDeleteDeletedTestCase.Item item1 = (CascadeDeleteDeletedTestCase.Item)objectSet
				.Next();
			CascadeDeleteDeletedTestCase.Item item2 = (CascadeDeleteDeletedTestCase.Item)objectSet
				.Next();
			if (delete)
			{
				oc.Delete(item1.untypedMember);
				oc.Delete(item1.typedMember);
			}
			oc.Delete(item1);
			if (commit)
			{
				oc.Commit();
			}
			oc.Delete(item2);
			if (!commit)
			{
				oc.Commit();
			}
		}
Ejemplo n.º 26
0
 public virtual void Commit()
 {
     db.Commit();
 }
Ejemplo n.º 27
0
 private static void EnsureMessageProcessed(IExtObjectContainer client)
 {
     client.Commit();
 }
Ejemplo n.º 28
0
 protected override void Update(IExtObjectContainer objectContainer)
 {
     objectContainer.Store(NewItem(2004, 2, 23));
     objectContainer.Commit();
 }
		private void TMembersFirst(IExtObjectContainer oc, string name)
		{
			bool commit = name.IndexOf("commit") > 1;
			IQuery q = oc.Query();
			q.Constrain(typeof(CascadeDeleteDeletedTestCase.Item));
			q.Descend("name").Constrain(name);
			IObjectSet objectSet = q.Execute();
			CascadeDeleteDeletedTestCase.Item cdd = (CascadeDeleteDeletedTestCase.Item)objectSet
				.Next();
			oc.Delete(cdd.untypedMember);
			oc.Delete(cdd.typedMember);
			if (commit)
			{
				oc.Commit();
			}
			oc.Delete(cdd);
			if (!commit)
			{
				oc.Commit();
			}
		}