Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        private TimeStamps AssertTimeStampsForSecondReplication(TimeStamps initialTimeStamps
                                                                , ITestableReplicationProviderInside provider)
        {
            TimeStamps timeStamps = provider.TimeStamps();

            Assert.IsNotNull(timeStamps);
            Assert.AreEqual(initialTimeStamps.Commit(), timeStamps.From());
            Assert.IsGreater(timeStamps.From(), timeStamps.To());
            Assert.AreEqual(timeStamps.To() + 1, timeStamps.Commit());
            return(timeStamps);
        }
Ejemplo n.º 3
0
        private TimeStamps AssertTimeStampsForFirstReplication(ITestableReplicationProviderInside
                                                               provider)
        {
            TimeStamps timeStamps = provider.TimeStamps();

            Assert.IsNotNull(timeStamps);
            Assert.AreEqual(0, timeStamps.From());
            Assert.IsGreater(0, timeStamps.To());
            Assert.AreEqual(timeStamps.To() + 1, timeStamps.Commit());
            return(timeStamps);
        }