public virtual void Test()
        {
            if (!A().Provider().SupportsMultiDimensionalArrays())
            {
                return;
            }
            if (!B().Provider().SupportsMultiDimensionalArrays())
            {
                return;
            }
            ArrayHolder h1 = new ArrayHolder("h1");
            ArrayHolder h2 = new ArrayHolder("h2");

            h1._array  = new ArrayHolder[] { h1 };
            h2._array  = new ArrayHolder[] { h1, h2, null };
            h1._arrayN = new ArrayHolder[][] { new ArrayHolder[] { h1 } };
            h2._arrayN = new ArrayHolder[][] { new ArrayHolder[] { h1, null }, new ArrayHolder
                                               [] { null, h2 }, new ArrayHolder[] { null, null } };
            //TODO Fix ReflectArray.shape() and test with innermost arrays of varying sizes:  {{h1}, {null, h2}, {null}}
            B().Provider().StoreNew(h2);
            B().Provider().StoreNew(h1);
            B().Provider().Commit();
            IReplicationSession replication = new GenericReplicationSession(A().Provider(), B
                                                                                ().Provider(), null, _fixtures.reflector);

            replication.Replicate(h2);
            //Traverses to h1.
            replication.Commit();
            IEnumerator objects = A().Provider().GetStoredObjects(typeof(ArrayHolder)).GetEnumerator
                                      ();

            CheckNext(objects);
            CheckNext(objects);
            Assert.IsFalse(objects.MoveNext());
        }
Exemplo n.º 2
0
        protected virtual void ActualTest()
        {
            if (!A().Provider().SupportsHybridCollection())
            {
                return;
            }
            if (!B().Provider().SupportsHybridCollection())
            {
                return;
            }
            CollectionHolder h1 = new CollectionHolder("h1");
            CollectionHolder h2 = new CollectionHolder("h2");

            h1.Map()["key"]  = "value";
            h1.Map()["key2"] = h1;
            h1.Map()[h1]     = "value2";
            h2.Map()["key"]  = h1;
            h2.Map()[h2]     = h1;
            h1.List().Add("one");
            h1.List().Add(h1);
            h2.List().Add("two");
            h2.List().Add(h1);
            h2.List().Add(h2);
            h1.Set().Add("one");
            h1.Set().Add(h1);
            h2.Set().Add("two");
            h2.Set().Add(h1);
            h2.Set().Add(h2);
            B().Provider().StoreNew(h2);
            B().Provider().StoreNew(h1);
            IReplicationSession replication = new GenericReplicationSession(A().Provider(), B
                                                                                ().Provider());

            replication.Replicate(h2);
            //Traverses to h1.
            replication.Commit();
            IEnumerator objects = A().Provider().GetStoredObjects(typeof(CollectionHolder)).GetEnumerator
                                      ();

            Check(NextCollectionHolder(objects), h1, h2);
            Check(NextCollectionHolder(objects), h1, h2);
        }
Exemplo n.º 3
0
        public virtual void Test()
        {
            Replicated obj1 = new Replicated("1");
            Replicated obj2 = new Replicated("2");
            Replicated obj3 = new Replicated("3");

            obj1.SetLink(obj2);
            obj2.SetLink(obj3);
            obj3.SetLink(obj1);
            _peerA.StoreNew(obj1);
            //_peerA.transientProviderSpecificStore(obj2);
            //_peerA.transientProviderSpecificStore(obj3);
            IReplicationSession replication = new GenericReplicationSession(_peerA, _peerB);

            replication.Replicate(obj1);
            Assert.IsTrue(_peerA.ActivatedObjects().Contains(obj1));
            Assert.IsTrue(_peerA.ActivatedObjects().Contains(obj2));
            Assert.IsTrue(_peerA.ActivatedObjects().Contains(obj3));
            _peerA = null;
            _peerB = null;
        }