CommonAbstractStore createDynamicArrayStore( File storeFile, File idFile, IdType idType, int blockSize ) { if ( blockSize <= 0 ) { throw new IllegalArgumentException( "Block size of dynamic array store should be positive integer." ); } return initialize( new DynamicArrayStore( storeFile, idFile, config, idType, idGeneratorFactory, pageCache, logProvider, blockSize, recordFormats, openOptions ) ); }
@Test public void failStoreInitializationWhenHeaderRecordCantBeRead() throws IOException { File storeFile = dir.file( "a" ); File idFile = dir.file( "idFile" ); PageCache pageCache = mock( PageCache.class ); PagedFile pagedFile = mock( PagedFile.class ); PageCursor pageCursor = mock( PageCursor.class ); when( pageCache.map( eq( storeFile ), anyInt(), any( OpenOption.class ) ) ).thenReturn( pagedFile ); when( pagedFile.io( 0L, PagedFile.PF_SHARED_READ_LOCK ) ).thenReturn( pageCursor ); when( pageCursor.next() ).thenReturn( false ); RecordFormats recordFormats = Standard.LATEST_RECORD_FORMATS; expectedException.expect( StoreNotFoundException.class ); expectedException.expectMessage( "Fail to read header record of store file: " + storeFile.getAbsolutePath() ); try ( DynamicArrayStore dynamicArrayStore = new DynamicArrayStore( storeFile, idFile, config, IdType.NODE_LABELS, idGeneratorFactory, pageCache, NullLogProvider.getInstance(), Settings.INTEGER.apply( GraphDatabaseSettings.label_block_size.getDefaultValue() ), recordFormats ) ) { dynamicArrayStore.initialise( false ); } }
CommonAbstractStore createDynamicArrayStore( File storeFile, File idFile, IdType idType, int blockSize ) { if ( blockSize <= 0 ) { throw new IllegalArgumentException( "Block size of dynamic array store should be positive integer." ); } return initialize( new DynamicArrayStore( storeFile, idFile, config, idType, idGeneratorFactory, pageCache, logProvider, blockSize, recordFormats, openOptions ) ); }