Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustCreateThresholdThatTriggersAfterTransactionCount()
        public virtual void MustCreateThresholdThatTriggersAfterTransactionCount()
        {
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(1);                 // Initialise at transaction id offset by 1.

            // False because we're not yet at threshold.
            assertFalse(threshold.IsCheckPointingNeeded(IntervalTx - 1, NotTriggered));
            // Still false because the counter is offset by one, since we initialised with 1.
            assertFalse(threshold.IsCheckPointingNeeded(IntervalTx, NotTriggered));
            // True because new we're at intervalTx + initial offset.
            assertTrue(threshold.IsCheckPointingNeeded(IntervalTx + 1, Triggered));
            VerifyTriggered("count");
            VerifyNoMoreTriggers();
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustCreateThresholdThatTriggersAfterTime()
        public virtual void MustCreateThresholdThatTriggersAfterTime()
        {
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(1);
            // Skip the initial wait period.
            Clock.forward(IntervalTime.toMillis(), MILLISECONDS);
            // The clock will trigger at a random point within the interval in the future.

            // False because we haven't moved the clock, or the transaction count.
            assertFalse(threshold.IsCheckPointingNeeded(2, NotTriggered));
            // True because we now moved forward by an interval.
            Clock.forward(IntervalTime.toMillis(), MILLISECONDS);
            assertTrue(threshold.IsCheckPointingNeeded(4, Triggered));
            VerifyTriggered("time");
            VerifyNoMoreTriggers();
        }
Exemple #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerOnTransactionCountWhenCountIsBellowThreshold()
        public virtual void MustNotTriggerOnTransactionCountWhenCountIsBellowThreshold()
        {
            WithIntervalTx(2);
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            assertFalse(threshold.IsCheckPointingNeeded(3, NotTriggered));
        }
Exemple #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerBeforeTimeWithTooFewCommittedTransactions()
        public virtual void MustNotTriggerBeforeTimeWithTooFewCommittedTransactions()
        {
            WithIntervalTime("100ms");
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            Clock.forward(50, MILLISECONDS);
            assertFalse(threshold.IsCheckPointingNeeded(42, NotTriggered));
        }
Exemple #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerWhenTransactionCountIsWithinThresholdSinceLastTrigger()
        public virtual void MustNotTriggerWhenTransactionCountIsWithinThresholdSinceLastTrigger()
        {
            WithIntervalTx(2);
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            threshold.CheckPointHappened(4);
            assertFalse(threshold.IsCheckPointingNeeded(5, NotTriggered));
        }
Exemple #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerOnTransactionCountAtThresholdIfCheckPointAlreadyHappened()
        public virtual void MustNotTriggerOnTransactionCountAtThresholdIfCheckPointAlreadyHappened()
        {
            WithIntervalTx(2);
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            threshold.CheckPointHappened(4);
            assertFalse(threshold.IsCheckPointingNeeded(4, NotTriggered));
        }
Exemple #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustTriggerOnTransactionCountWhenCountIsAtThreshold()
        public virtual void MustTriggerOnTransactionCountWhenCountIsAtThreshold()
        {
            WithIntervalTx(2);
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            assertTrue(threshold.IsCheckPointingNeeded(4, Triggered));
            VerifyTriggered("count");
            VerifyNoMoreTriggers();
        }
Exemple #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerWhenTimeThresholdIsReachedAndThereAreNoCommittedTransactions()
        public virtual void MustNotTriggerWhenTimeThresholdIsReachedAndThereAreNoCommittedTransactions()
        {
            WithIntervalTime("100ms");
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(42);

            Clock.forward(199, MILLISECONDS);

            assertFalse(threshold.IsCheckPointingNeeded(42, NotTriggered));
            VerifyNoMoreTriggers();
        }
Exemple #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerPastTimeThresholdSinceLastCheckpointWithNoNewTransactions()
        public virtual void MustNotTriggerPastTimeThresholdSinceLastCheckpointWithNoNewTransactions()
        {
            WithIntervalTime("100ms");
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            Clock.forward(199, MILLISECONDS);
            threshold.CheckPointHappened(42);
            Clock.forward(100, MILLISECONDS);

            assertFalse(threshold.IsCheckPointingNeeded(42, NotTriggered));
            VerifyNoMoreTriggers();
        }