Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCreateAnUpdaterForMultipleVersionUpdatesNotInOrder()
        public virtual void ShouldCreateAnUpdaterForMultipleVersionUpdatesNotInOrder()
        {
            // given
            long initialVersion = 42;

            when(_store.version()).thenReturn(initialVersion);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ConcurrentMapState<?> state = createMapState();
            ConcurrentMapState <object> state = CreateMapState();

            // when
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: EntryUpdater<?> updater;
            EntryUpdater <object> updater;

            long updateVersion = 45;

            updater = state.Updater(updateVersion, @lock);
            updater.Close();

            updateVersion = 43;
            updater       = state.Updater(updateVersion, @lock);
            updater.Close();

            updateVersion = 44;
            updater       = state.Updater(updateVersion, @lock);
            updater.Close();

            // then
            // it does not blow up
            assertNotNull(updater);
            assertEquals(45, state.Version());
        }
Esempio n. 2
0
 internal Prototype(ConcurrentMapState <Key> state, long version) : base(state)
 {
     this.VersionContextSupplier = state.VersionContextSupplier;
     Threshold                  = version;
     HasTrackedChanges          = new AtomicBoolean();
     this.HighestAppliedVersion = new AtomicLong(version);
 }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void markDirtyVersionLookupOnKeyReset() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MarkDirtyVersionLookupOnKeyReset()
        {
            long updaterVersionTxId = 25;
            long lastClosedTxId     = 20;

            when(_store.version()).thenReturn(updaterVersionTxId);
            TransactionVersionContextSupplier versionContextSupplier = new TransactionVersionContextSupplier();

            versionContextSupplier.Init(() => lastClosedTxId);
            VersionContext versionContext = versionContextSupplier.VersionContext;

            ConcurrentMapState <string> mapState = CreateMapState(versionContextSupplier);

            versionContext.InitRead();
            mapState.ResettingUpdater(@lock, Runnables.EMPTY_RUNNABLE).apply("a", new SimpleValueUpdate(1));
            mapState.Lookup("a", new EmptyValueSink());
            assertTrue(versionContext.Dirty);
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldUseEmptyUpdaterOnVersionLowerOrEqualToTheInitialVersion()
        public virtual void ShouldUseEmptyUpdaterOnVersionLowerOrEqualToTheInitialVersion()
        {
            // given
            long initialVersion = 42;

            when(_store.version()).thenReturn(initialVersion);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ConcurrentMapState<?> state = createMapState();
            ConcurrentMapState <object> state = CreateMapState();

            // when
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: EntryUpdater<?> updater = state.updater(initialVersion, lock);
            EntryUpdater <object> updater = state.Updater(initialVersion, @lock);

            // expected
            assertEquals("Empty updater should be used for version less or equal to initial", EntryUpdater.NoUpdates(), updater);
        }
Esempio n. 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void doNotMarkVersionAsDirtyOnAnotherKeyUpdate() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void DoNotMarkVersionAsDirtyOnAnotherKeyUpdate()
        {
            long updaterVersionTxId = 25;
            long lastClosedTxId     = 20;
            TransactionVersionContextSupplier versionContextSupplier = new TransactionVersionContextSupplier();

            versionContextSupplier.Init(() => lastClosedTxId);
            ConcurrentMapState <string> mapState = CreateMapState(versionContextSupplier);
            VersionContext versionContext        = versionContextSupplier.VersionContext;

            using (EntryUpdater <string> updater = mapState.Updater(updaterVersionTxId, @lock))
            {
                updater.Apply("b", new SimpleValueUpdate(2));
            }

            assertEquals(updaterVersionTxId, mapState.Version());
            versionContext.InitRead();
            mapState.Lookup("a", new EmptyValueSink());
            assertFalse(versionContext.Dirty);
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCreateAnUpdaterForAnUnseenVersionUpdateWithAGap()
        public virtual void ShouldCreateAnUpdaterForAnUnseenVersionUpdateWithAGap()
        {
            // given
            long initialVersion = 42;

            when(_store.version()).thenReturn(initialVersion);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ConcurrentMapState<?> state = createMapState();
            ConcurrentMapState <object> state = CreateMapState();

            // when
            long updateVersion = 45;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final EntryUpdater<?> updater = state.updater(updateVersion, lock);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
            EntryUpdater <object> updater = state.Updater(updateVersion, @lock);

            updater.Close();

            // then
            // it does not blow up
            assertNotNull(updater);
            assertEquals(updateVersion, state.Version());
        }
Esempio n. 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected DataProvider dataProvider() throws java.io.IOException
            protected internal override DataProvider DataProvider()
            {
                return(ConcurrentMapState.dataProvider(Store, Changes));
            }
Esempio n. 8
0
 public EntryUpdaterAnonymousInnerClass(ConcurrentMapState <Key> outerInstance, Lock @lock, ThreadStart closeAction) : base(@lock)
 {
     this.outerInstance = outerInstance;
     this._closeAction  = closeAction;
 }