예제 #1
0
        private ArrayValue Array(RecordPropertyCursor cursor, long reference, PageCursor page)
        {
            ByteBuffer buffer = cursor.Buffer = _read.loadArray(reference, cursor.Buffer, page);

            buffer.flip();
            return(PropertyStore.readArrayFromBuffer(buffer));
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void startStore()
        public virtual void StartStore()
        {
            _neoStores     = (new StoreFactory(Storage.directory().databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(Storage.fileSystem()), Storage.pageCache(), Storage.fileSystem(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY)).openNeoStores(true, StoreType.PROPERTY, StoreType.PROPERTY_STRING, StoreType.PROPERTY_ARRAY);
            _propertyStore = _neoStores.PropertyStore;
            _records       = new DirectRecordAccess <PropertyRecord, PrimitiveRecord>(_propertyStore, Loaders.PropertyLoader(_propertyStore));
            _creator       = new PropertyCreator(_propertyStore, new PropertyTraverser());
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void before()
        public virtual void Before()
        {
            StoreFactory storeFactory = new StoreFactory(_testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(_fs.get()), PageCacheRule.getPageCache(_fs.get()), _fs.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY);

            _neoStores = storeFactory.OpenAllNeoStores(true);
            _store     = _neoStores.PropertyStore;
            _converter = new PropertyPhysicalToLogicalConverter(_store);
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void propertyCursorShouldClosePageCursor()
        internal virtual void PropertyCursorShouldClosePageCursor()
        {
            PropertyStore store      = mock(typeof(PropertyStore));
            PageCursor    pageCursor = mock(typeof(PageCursor));

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

            using (RecordPropertyCursor cursor = new RecordPropertyCursor(store))
            {
                cursor.Init(0);
            }
            verify(pageCursor).close();
        }
예제 #5
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());
        }
예제 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDetectAndAbortPropertyChainLoadingOnCircularReference() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDetectAndAbortPropertyChainLoadingOnCircularReference()
        {
            // given
            NeoStores neoStores = StoresRule.builder().build();

            // Create property chain 1 --> 2 --> 3 --> 4
            //                             ↑           │
            //                             └───────────┘
            PropertyStore  propertyStore = neoStores.PropertyStore;
            PropertyRecord record        = propertyStore.NewRecord();

            // 1
            record.Id = 1;
            record.Initialize(true, -1, 2);
            propertyStore.UpdateRecord(record);
            // 2
            record.Id = 2;
            record.Initialize(true, 1, 3);
            propertyStore.UpdateRecord(record);
            // 3
            record.Id = 3;
            record.Initialize(true, 2, 4);
            propertyStore.UpdateRecord(record);
            // 4
            record.Id = 4;
            record.Initialize(true, 3, 2);                 // <-- completing the circle
            propertyStore.UpdateRecord(record);

            // when
            PropertyReader reader = new PropertyReader(new StoreAccess(neoStores));

            try
            {
                reader.GetPropertyRecordChain(1);
                fail("Should have detected circular reference");
            }
            catch (PropertyReader.CircularPropertyRecordChainException e)
            {
                // then good
                assertEquals(4, e.PropertyRecordClosingTheCircle().Id);
            }
        }
예제 #7
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);
        }
예제 #8
0
 internal NodeInputIdPropertyLookup(PropertyStore propertyStore)
 {
     this._propertyStore  = propertyStore;
     this._propertyRecord = propertyStore.NewRecord();
 }
예제 #9
0
 internal RecordPropertyCursor(PropertyStore read) : base(NO_ID)
 {
     this._read = read;
 }