Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void checkClientsIdBounds() throws java.util.concurrent.ExecutionException, InterruptedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void CheckClientsIdBounds()
        {
            int                threads     = 2;
            DefaultCounts      counts      = new DefaultCounts(threads);
            DefaultCacheAccess cacheAccess = new DefaultCacheAccess(counts, threads);

            cacheAccess.PrepareForProcessingOfSingleStore(34);

            CacheAccess_Client client1 = cacheAccess.Client();

            assertTrue(client1.WithinBounds(0));
            assertTrue(client1.WithinBounds(10));
            assertTrue(client1.WithinBounds(33));
            assertFalse(client1.WithinBounds(34));

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.concurrent.Future<?> secondClientIdChecks = executor.submit(() ->
            Future <object> secondClientIdChecks = _executor.submit(() =>
            {
                CacheAccess_Client client = cacheAccess.Client();
                assertFalse(client.WithinBounds(5));
                assertFalse(client.WithinBounds(33));
                assertTrue(client.WithinBounds(34));
                assertTrue(client.WithinBounds(67));
                assertFalse(client.WithinBounds(68));
            });

            secondClientIdChecks.get();
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void scanForHighIdOnlyOnceWhenProcessCache()
        internal virtual void ScanForHighIdOnlyOnceWhenProcessCache()
        {
            NeoStores      neoStores      = mock(typeof(NeoStores), Mockito.RETURNS_MOCKS);
            NodeStore      nodeStore      = mock(typeof(NodeStore));
            NodeRecord     nodeRecord     = mock(typeof(NodeRecord));
            StoreProcessor storeProcessor = mock(typeof(StoreProcessor));

            when(neoStores.NodeStore).thenReturn(nodeStore);
            when(nodeStore.HighId).thenReturn(10L);
            when(nodeStore.GetRecord(anyLong(), any(typeof(NodeRecord)), any(typeof(RecordLoad)))).thenReturn(nodeRecord);
            when(nodeStore.NewRecord()).thenReturn(nodeRecord);

            StoreAccess storeAccess = new StoreAccess(neoStores);

            storeAccess.Initialize();

            DefaultCacheAccess cacheAccess = new DefaultCacheAccess(Counts.NONE, 1);

            CacheTask.CheckNextRel cacheTask = new CacheTask.CheckNextRel(Org.Neo4j.Consistency.checking.full.Stage_Fields.SequentialForward, cacheAccess, storeAccess, storeProcessor);

            cacheAccess.CacheSlotSizes = CheckStage.Stage5_Check_NextRel.CacheSlotSizes;
            cacheTask.ProcessCache();

            verify(nodeStore, times(1)).HighId;
        }
Ejemplo n.º 3
0
 internal DefaultClient(DefaultCacheAccess outerInstance, int threadIndex)
 {
     this._outerInstance = outerInstance;
     this.ThreadIndex    = threadIndex;
 }