Ejemplo n.º 1
0
 public virtual void TestDelete()
 {
     EmbeddedClientObjectContainerTestCase.Item item = StoreItemToClient1AndCommit();
     Assert.IsTrue(_client1.IsStored(item));
     _client1.Delete(item);
     Assert.IsFalse(_client1.IsStored(item));
 }
Ejemplo n.º 2
0
 public virtual void TestIsStored()
 {
     EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                 ();
     Assert.IsTrue(_client1.IsStored(storedItem));
     Assert.IsFalse(_client2.IsStored(storedItem));
 }
Ejemplo n.º 3
0
 public virtual void TestPeekPersisted()
 {
     EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                 ();
     storedItem._name = ChangedName;
     _client1.Store(storedItem);
     EmbeddedClientObjectContainerTestCase.Item peekedItem = (EmbeddedClientObjectContainerTestCase.Item
                                                              )((EmbeddedClientObjectContainerTestCase.Item)_client1.PeekPersisted(storedItem,
                                                                                                                                   2, true));
     Assert.IsNotNull(peekedItem);
     Assert.AreNotSame(peekedItem, storedItem);
     Assert.AreEqual(OriginalName, peekedItem._name);
     peekedItem = (EmbeddedClientObjectContainerTestCase.Item)((EmbeddedClientObjectContainerTestCase.Item
                                                                )_client1.PeekPersisted(storedItem, 2, false));
     Assert.IsNotNull(peekedItem);
     Assert.AreNotSame(peekedItem, storedItem);
     Assert.AreEqual(ChangedName, peekedItem._name);
     EmbeddedClientObjectContainerTestCase.Item retrievedItem = RetrieveItemFromClient2
                                                                    ();
     peekedItem = (EmbeddedClientObjectContainerTestCase.Item)((EmbeddedClientObjectContainerTestCase.Item
                                                                )_client2.PeekPersisted(retrievedItem, 2, false));
     Assert.IsNotNull(peekedItem);
     Assert.AreNotSame(peekedItem, retrievedItem);
     Assert.AreEqual(OriginalName, peekedItem._name);
 }
Ejemplo n.º 4
0
        public virtual void TestGetByID()
        {
            EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                        ();
            long id = _client1.GetID(storedItem);

            Assert.AreSame(storedItem, _client1.GetByID(id));
        }
Ejemplo n.º 5
0
        public virtual void TestGetID()
        {
            EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                        ();
            long id = _client1.GetID(storedItem);

            Assert.IsGreater(1, id);
        }
Ejemplo n.º 6
0
 public virtual void TestRefresh()
 {
     EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                 ();
     storedItem._name = ChangedName;
     _client1.Refresh(storedItem, 2);
     Assert.AreEqual(OriginalName, storedItem._name);
 }
Ejemplo n.º 7
0
        public virtual void TestGetObjectInfo()
        {
            EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                        ();
            IObjectInfo objectInfo = _client1.GetObjectInfo(storedItem);

            Assert.IsNotNull(objectInfo);
        }
Ejemplo n.º 8
0
 protected virtual EmbeddedClientObjectContainerTestCase.Item StoreItemToClient1AndCommit
     ()
 {
     EmbeddedClientObjectContainerTestCase.Item storedItem = new EmbeddedClientObjectContainerTestCase.Item
                                                                 (OriginalName);
     _client1.Store(storedItem);
     _client1.Commit();
     return(storedItem);
 }
Ejemplo n.º 9
0
        public virtual void TestGet()
        {
            EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                        ();
            object retrievedItem = _client1.QueryByExample(new EmbeddedClientObjectContainerTestCase.Item
                                                               ()).Next();

            Assert.AreSame(storedItem, retrievedItem);
        }
		public virtual void TestSetAndCommitIsolation()
		{
			EmbeddedClientObjectContainerTestCase.Item item = new EmbeddedClientObjectContainerTestCase.Item
				("one");
			_client1.Store(item);
			AssertItemCount(_client2, 0);
			_client1.Commit();
			AssertItemCount(_client2, 1);
		}
Ejemplo n.º 11
0
 public virtual void TestSetAndCommitIsolation()
 {
     EmbeddedClientObjectContainerTestCase.Item item = new EmbeddedClientObjectContainerTestCase.Item
                                                           ("one");
     _client1.Store(item);
     AssertItemCount(_client2, 0);
     _client1.Commit();
     AssertItemCount(_client2, 1);
 }
Ejemplo n.º 12
0
 public virtual void TestDeactivate()
 {
     EmbeddedClientObjectContainerTestCase.Item       item   = StoreItemToClient1AndCommit();
     EmbeddedClientObjectContainerTestCase.ItemHolder holder = new EmbeddedClientObjectContainerTestCase.ItemHolder
                                                                   (item);
     _client1.Store(holder);
     _client1.Commit();
     _client1.Deactivate(holder, 1);
     Assert.IsNull(holder._item);
 }
		public virtual void TestReferenceSystemIsolation()
		{
			EmbeddedClientObjectContainerTestCase.Item item = new EmbeddedClientObjectContainerTestCase.Item
				("one");
			_client1.Store(item);
			_client1.Commit();
			EmbeddedClientObjectContainerTestCase.Item client2Item = RetrieveItemFromClient2(
				);
			Assert.AreNotSame(item, client2Item);
		}
Ejemplo n.º 14
0
 public virtual void TestReferenceSystemIsolation()
 {
     EmbeddedClientObjectContainerTestCase.Item item = new EmbeddedClientObjectContainerTestCase.Item
                                                           ("one");
     _client1.Store(item);
     _client1.Commit();
     EmbeddedClientObjectContainerTestCase.Item client2Item = RetrieveItemFromClient2(
         );
     Assert.AreNotSame(item, client2Item);
 }
Ejemplo n.º 15
0
        public virtual void TestGetByUUID()
        {
            EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                        ();
            IObjectInfo objectInfo    = _client1.GetObjectInfo(storedItem);
            object      retrievedItem = _client1.GetByUUID(objectInfo.GetUUID());

            Assert.AreSame(storedItem, retrievedItem);
            retrievedItem = _client2.GetByUUID(objectInfo.GetUUID());
            Assert.AreNotSame(storedItem, retrievedItem);
        }
Ejemplo n.º 16
0
 public virtual void TestCommitOnClose()
 {
     EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                 ();
     storedItem._name = ChangedName;
     _client1.Store(storedItem);
     _client1.Close();
     EmbeddedClientObjectContainerTestCase.Item retrievedItem = RetrieveItemFromClient2
                                                                    ();
     Assert.AreEqual(ChangedName, retrievedItem._name);
 }
Ejemplo n.º 17
0
        private EmbeddedClientObjectContainerTestCase.Item RetrieveItemFromClient2()
        {
            IQuery query = _client2.Query();

            query.Constrain(typeof(EmbeddedClientObjectContainerTestCase.Item));
            IObjectSet objectSet = query.Execute();

            EmbeddedClientObjectContainerTestCase.Item retrievedItem = (EmbeddedClientObjectContainerTestCase.Item
                                                                        )objectSet.Next();
            return(retrievedItem);
        }
Ejemplo n.º 18
0
 public virtual void TestSetWithDepth()
 {
     EmbeddedClientObjectContainerTestCase.Item       item   = StoreItemToClient1AndCommit();
     EmbeddedClientObjectContainerTestCase.ItemHolder holder = new EmbeddedClientObjectContainerTestCase.ItemHolder
                                                                   (item);
     _client1.Store(holder);
     _client1.Commit();
     item._name = ChangedName;
     _client1.Store(holder, 3);
     _client1.Refresh(holder, 3);
     Assert.AreEqual(ChangedName, item._name);
 }
Ejemplo n.º 19
0
        public virtual void TestIsCached()
        {
            EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                        ();
            long id = _client1.GetID(storedItem);

            Assert.IsFalse(_client2.IsCached(id));
            EmbeddedClientObjectContainerTestCase.Item retrievedItem = (EmbeddedClientObjectContainerTestCase.Item
                                                                        )_client2.GetByID(id);
            Assert.IsNotNull(retrievedItem);
            Assert.IsTrue(_client2.IsCached(id));
        }
Ejemplo n.º 20
0
        public virtual void TestBindIsolation()
        {
            EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                        ();
            long id = _client1.GetID(storedItem);

            EmbeddedClientObjectContainerTestCase.Item retrievedItem = RetrieveItemFromClient2
                                                                           ();
            EmbeddedClientObjectContainerTestCase.Item boundItem = new EmbeddedClientObjectContainerTestCase.Item
                                                                       (ChangedName);
            _client1.Bind(boundItem, id);
            Assert.AreSame(boundItem, _client1.GetByID(id));
            Assert.AreSame(retrievedItem, _client2.GetByID(id));
        }
Ejemplo n.º 21
0
        public virtual void TestActivate()
        {
            EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                        ();
            long id = _client1.GetID(storedItem);

            EmbeddedClientObjectContainerTestCase.Item retrievedItem = (EmbeddedClientObjectContainerTestCase.Item
                                                                        )_client2.GetByID(id);
            Assert.IsNull(retrievedItem._name);
            Assert.IsFalse(_client2.IsActive(retrievedItem));
            _client2.Activate(retrievedItem, 1);
            Assert.AreEqual(OriginalName, retrievedItem._name);
            Assert.IsTrue(_client2.IsActive(retrievedItem));
        }
Ejemplo n.º 22
0
        public virtual void TestDescendIsolation()
        {
            EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                        ();
            storedItem._name = ChangedName;
            _client1.Store(storedItem);
            int    id            = (int)_client1.GetID(storedItem);
            object retrievedItem = _client2.GetByID(id);

            Assert.IsNotNull(retrievedItem);
            object descendValue = _client2.Descend(retrievedItem, new string[] { FieldName });

            Assert.AreEqual(OriginalName, descendValue);
            _client1.Commit();
            descendValue = _client2.Descend(retrievedItem, new string[] { FieldName });
            Assert.AreEqual(ChangedName, descendValue);
        }
Ejemplo n.º 23
0
        public virtual void TestStoredFieldIsolation()
        {
            EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
                                                                        ();
            storedItem._name = ChangedName;
            _client1.Store(storedItem);
            EmbeddedClientObjectContainerTestCase.Item retrievedItem = RetrieveItemFromClient2
                                                                           ();
            IStoredClass storedClass = _client2.StoredClass(typeof(EmbeddedClientObjectContainerTestCase.Item
                                                                   ));
            IStoredField storedField   = storedClass.StoredField(FieldName, null);
            object       retrievedName = storedField.Get(retrievedItem);

            Assert.AreEqual(OriginalName, retrievedName);
            _client1.Commit();
            retrievedName = storedField.Get(retrievedItem);
            Assert.AreEqual(ChangedName, retrievedName);
        }
Ejemplo n.º 24
0
 public virtual bool Match(EmbeddedClientObjectContainerTestCase.Item item)
 {
     return(true);
 }
		protected virtual EmbeddedClientObjectContainerTestCase.Item StoreItemToClient1AndCommit
			()
		{
			EmbeddedClientObjectContainerTestCase.Item storedItem = new EmbeddedClientObjectContainerTestCase.Item
				(OriginalName);
			_client1.Store(storedItem);
			_client1.Commit();
			return storedItem;
		}
			public ItemHolder(EmbeddedClientObjectContainerTestCase.Item item)
			{
				_item = item;
			}
		public virtual void TestBindIsolation()
		{
			EmbeddedClientObjectContainerTestCase.Item storedItem = StoreItemToClient1AndCommit
				();
			long id = _client1.GetID(storedItem);
			EmbeddedClientObjectContainerTestCase.Item retrievedItem = RetrieveItemFromClient2
				();
			EmbeddedClientObjectContainerTestCase.Item boundItem = new EmbeddedClientObjectContainerTestCase.Item
				(ChangedName);
			_client1.Bind(boundItem, id);
			Assert.AreSame(boundItem, _client1.GetByID(id));
			Assert.AreSame(retrievedItem, _client2.GetByID(id));
		}
Ejemplo n.º 28
0
 public ItemHolder(EmbeddedClientObjectContainerTestCase.Item item)
 {
     _item = item;
 }