Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void relationshipGroupCursorShouldClosePageCursor()
        internal virtual void RelationshipGroupCursorShouldClosePageCursor()
        {
            RelationshipStore relationshipStore      = mock(typeof(RelationshipStore));
            PageCursor        relationshipPageCursor = mock(typeof(PageCursor));

            when(relationshipStore.OpenPageCursorForReading(anyLong())).thenReturn(relationshipPageCursor);
            RelationshipGroupStore store      = mock(typeof(RelationshipGroupStore));
            PageCursor             pageCursor = mock(typeof(PageCursor));

            when(store.OpenPageCursorForReading(anyLong())).thenReturn(pageCursor);

            using (RecordRelationshipGroupCursor cursor = new RecordRelationshipGroupCursor(relationshipStore, store))
            {
                cursor.Init(0, 0);
            }
            verify(pageCursor).close();
            verifyZeroInteractions(relationshipStore, relationshipPageCursor);
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldClearStateOnClose()
        public virtual void ShouldClearStateOnClose()
        {
            // GIVEN
            NeoStores mockStore = mock(typeof(NeoStores));
            NodeStore store     = mock(typeof(NodeStore));

            when(mockStore.NodeStore).thenReturn(store);
            RelationshipStore relationshipStore = mock(typeof(RelationshipStore));

            when(mockStore.RelationshipStore).thenReturn(relationshipStore);
            PropertyStore propertyStore = mock(typeof(PropertyStore));

            when(mockStore.PropertyStore).thenReturn(propertyStore);
            SchemaStore schemaStore = mock(typeof(SchemaStore));

            when(mockStore.SchemaStore).thenReturn(schemaStore);
            RelationshipGroupStore groupStore = mock(typeof(RelationshipGroupStore));

            when(mockStore.RelationshipGroupStore).thenReturn(groupStore);

            RecordChangeSet changeSet = new RecordChangeSet(new Loaders(mockStore));

            // WHEN

            /*
             * We need to make sure some stuff is stored in the sets being managed. That is why forChangingLinkage() is
             * called - otherwise, no changes will be stored and changeSize() would return 0 anyway.
             */
            changeSet.NodeRecords.create(1L, null).forChangingLinkage();
            changeSet.PropertyRecords.create(1L, null).forChangingLinkage();
            changeSet.RelRecords.create(1L, null).forChangingLinkage();
            changeSet.SchemaRuleChanges.create(1L, null).forChangingLinkage();
            changeSet.RelGroupRecords.create(1L, 1).forChangingLinkage();

            changeSet.Close();

            // THEN
            assertEquals(0, changeSet.NodeRecords.changeSize());
            assertEquals(0, changeSet.PropertyRecords.changeSize());
            assertEquals(0, changeSet.RelRecords.changeSize());
            assertEquals(0, changeSet.SchemaRuleChanges.changeSize());
            assertEquals(0, changeSet.RelGroupRecords.changeSize());
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings({"unchecked", "rawtypes"}) public static org.neo4j.kernel.impl.store.NeoStores basicMockedNeoStores()
        public static NeoStores BasicMockedNeoStores()
        {
            NeoStores neoStores = mock(typeof(NeoStores));

            // NodeStore - DynamicLabelStore
            NodeStore nodeStore = mock(typeof(NodeStore));

            when(neoStores.NodeStore).thenReturn(nodeStore);

            // NodeStore - DynamicLabelStore
            DynamicArrayStore dynamicLabelStore = mock(typeof(DynamicArrayStore));

            when(nodeStore.DynamicLabelStore).thenReturn(dynamicLabelStore);

            // RelationshipStore
            RelationshipStore relationshipStore = mock(typeof(RelationshipStore));

            when(neoStores.RelationshipStore).thenReturn(relationshipStore);

            // RelationshipGroupStore
            RelationshipGroupStore relationshipGroupStore = mock(typeof(RelationshipGroupStore));

            when(neoStores.RelationshipGroupStore).thenReturn(relationshipGroupStore);

            // PropertyStore
            PropertyStore propertyStore = mock(typeof(PropertyStore));

            when(neoStores.PropertyStore).thenReturn(propertyStore);

            // PropertyStore -- DynamicStringStore
            DynamicStringStore propertyStringStore = mock(typeof(DynamicStringStore));

            when(propertyStore.StringStore).thenReturn(propertyStringStore);

            // PropertyStore -- DynamicArrayStore
            DynamicArrayStore propertyArrayStore = mock(typeof(DynamicArrayStore));

            when(propertyStore.ArrayStore).thenReturn(propertyArrayStore);

            return(neoStores);
        }