Esempio n. 1
0
		protected virtual void Delete(ITestableReplicationProviderInside provider)
		{
			ArrayList toDelete = new ArrayList();
			IEnumerator rr = provider.GetStoredObjects(typeof(R0)).GetEnumerator();
			while (rr.MoveNext())
			{
				object o = rr.Current;
				IReflectClass claxx = ReplicationReflector().ForObject(o);
				SetFieldsToNull(o, claxx);
				toDelete.Add(o);
			}
			object commitObject = null;
			for (IEnumerator iterator = toDelete.GetEnumerator(); iterator.MoveNext(); )
			{
				object o = iterator.Current;
				//System.out.println("o = " + o);
				provider.Delete(o);
				commitObject = o;
			}
			if (commitObject != null)
			{
				provider.Commit();
			}
			else
			{
				provider.Commit();
			}
		}
Esempio n. 2
0
        protected virtual void Delete(ITestableReplicationProviderInside provider)
        {
            ArrayList   toDelete = new ArrayList();
            IEnumerator rr       = provider.GetStoredObjects(typeof(R0)).GetEnumerator();

            while (rr.MoveNext())
            {
                object        o     = rr.Current;
                IReflectClass claxx = ReplicationReflector().ForObject(o);
                SetFieldsToNull(o, claxx);
                toDelete.Add(o);
            }
            object commitObject = null;

            for (IEnumerator iterator = toDelete.GetEnumerator(); iterator.MoveNext();)
            {
                object o = iterator.Current;
                //System.out.println("o = " + o);
                provider.Delete(o);
                commitObject = o;
            }
            if (commitObject != null)
            {
                provider.Commit();
            }
            else
            {
                provider.Commit();
            }
        }
        private void StoreToProviderA()
        {
            ITestableReplicationProviderInside providerA = A().Provider();

            providerA.StoreNew(CreateItem());
            providerA.Commit();
        }
Esempio n. 4
0
        public virtual void Test()
        {
            ITestableReplicationProviderInside providerA = A().Provider();
            ITestableReplicationProviderInside providerB = B().Provider();

            providerA.StoreNew(new Pilot());
            providerA.Commit();
            IReplicationSession replication = Replication.Begin(providerA, providerB, null, _fixtures
                                                                .reflector);
            TimeStamps initialTimeStampsB = AssertTimeStampsForFirstReplication(providerB);
            IObjectSet modifiedObjects    = providerA.ObjectsChangedSinceLastReplication();

            while (modifiedObjects.HasNext())
            {
                replication.Replicate(modifiedObjects.Next());
            }
            replication.Commit();
            Pilot replicatedPilot = (Pilot)providerB.GetStoredObjects(typeof(Pilot)).Next();
            long  version         = providerB.ObjectVersion(replicatedPilot);

            Assert.AreEqual(initialTimeStampsB.Commit(), version);
            replication = Replication.Begin(providerA, providerB, null, _fixtures.reflector);
            TimeStamps timestampsBAfterReplication = AssertTimeStampsForSecondReplication(initialTimeStampsB
                                                                                          , providerB);

            replication.Commit();
            Pilot pilotStoredAfterReplication = new Pilot();

            providerB.StoreNew(pilotStoredAfterReplication);
            providerB.Commit();
            providerB.WaitForPreviousCommits();
            version = providerB.ObjectVersion(pilotStoredAfterReplication);
            Assert.IsGreater(timestampsBAfterReplication.Commit(), version);
        }
 private void StoreNewAndCommit(ITestableReplicationProviderInside provider, CollectionHolder
                                h1)
 {
     provider.StoreNew(h1);
     provider.Activate(h1);
     provider.Commit();
 }
		private void StoreNewPilotIn(ITestableReplicationProviderInside provider)
		{
			Pilot pilot = new Pilot();
			provider.StoreNew(pilot);
			provider.Commit();
			provider.WaitForPreviousCommits();
		}
Esempio n. 7
0
        internal virtual void StoreToProviderA()
        {
            ITestableReplicationProviderInside provider = A().Provider();

            provider.StoreNew(template);
            provider.Commit();
            EnsureContent(template, provider);
        }
        private void StoreNewPilotIn(ITestableReplicationProviderInside provider)
        {
            Pilot pilot = new Pilot();

            provider.StoreNew(pilot);
            provider.Commit();
            provider.WaitForPreviousCommits();
        }
Esempio n. 9
0
        private void Store(IDrsProviderFixture fixture, SimpleListHolder listHolder)
        {
            ITestableReplicationProviderInside provider = fixture.Provider();

            provider.StoreNew(listHolder);
            provider.StoreNew(GetItem(listHolder, "foo"));
            provider.StoreNew(GetItem(listHolder, "foobar"));
            provider.Commit();
            EnsureContents(fixture, listHolder);
        }
		private void ModifyPilotIn(ITestableReplicationProviderInside provider, string newName
			)
		{
			Pilot pilot;
			pilot = (Pilot)provider.GetStoredObjects(typeof(Pilot)).Next();
			pilot.SetName(newName);
			provider.Update(pilot);
			provider.Commit();
			provider.WaitForPreviousCommits();
		}
        private void ModifyPilotIn(ITestableReplicationProviderInside provider, string newName
                                   )
        {
            Pilot pilot;

            pilot = (Pilot)provider.GetStoredObjects(typeof(Pilot)).Next();
            pilot.SetName(newName);
            provider.Update(pilot);
            provider.Commit();
            provider.WaitForPreviousCommits();
        }
Esempio n. 12
0
        private void ModifyR4(ITestableReplicationProviderInside provider)
        {
            object      commitObject = null;
            IEnumerator it           = provider.GetStoredObjects(typeof(R4)).GetEnumerator();

            while (it.MoveNext())
            {
                R4 r4 = (R4)it.Current;
                r4.SetName(r4.GetName() + "_");
                provider.Update(r4);
                commitObject = r4;
            }
            provider.Commit();
        }
Esempio n. 13
0
        private void Init(ITestableReplicationProviderInside peerA)
        {
            R0Linker lCircles = new R0Linker();

            lCircles.SetNames("circles");
            lCircles.LinkCircles();
            lCircles.Store(peerA);
            R0Linker lList = new R0Linker();

            lList.SetNames("list");
            lList.LinkList();
            lList.Store(peerA);
            R0Linker lThis = new R0Linker();

            lThis.SetNames("this");
            lThis.LinkThis();
            lThis.Store(peerA);
            R0Linker lBack = new R0Linker();

            lBack.SetNames("back");
            lBack.LinkBack();
            lBack.Store(peerA);
            peerA.Commit();
        }
Esempio n. 14
0
		private void ModifyR4(ITestableReplicationProviderInside provider)
		{
			object commitObject = null;
			IEnumerator it = provider.GetStoredObjects(typeof(R4)).GetEnumerator();
			while (it.MoveNext())
			{
				R4 r4 = (R4)it.Current;
				r4.SetName(r4.GetName() + "_");
				provider.Update(r4);
				commitObject = r4;
			}
			provider.Commit();
		}
Esempio n. 15
0
		private void Init(ITestableReplicationProviderInside peerA)
		{
			R0Linker lCircles = new R0Linker();
			lCircles.SetNames("circles");
			lCircles.LinkCircles();
			lCircles.Store(peerA);
			R0Linker lList = new R0Linker();
			lList.SetNames("list");
			lList.LinkList();
			lList.Store(peerA);
			R0Linker lThis = new R0Linker();
			lThis.SetNames("this");
			lThis.LinkThis();
			lThis.Store(peerA);
			R0Linker lBack = new R0Linker();
			lBack.SetNames("back");
			lBack.LinkBack();
			lBack.Store(peerA);
			peerA.Commit();
		}
			private void StoreNewAndCommit(ITestableReplicationProviderInside provider, CollectionHolder
				 h1)
			{
				provider.StoreNew(h1);
				provider.Activate(h1);
				provider.Commit();
			}