random.nextInt( currentCount ) ); store.getRecords( blockId, NORMAL ); byte[] bytes = (byte[]) store.getArrayFor( store.getRecords( blockId, NORMAL ) ); validateData( bytes, byteData.remove( blockId ) ); Collection<DynamicRecord> records = store.getRecords( blockId, NORMAL );
@Test public void testAddDeleteSequenceEmptyStringArray() { DynamicArrayStore store = createDynamicArrayStore(); long blockId = create( store, new String[0] ); store.getRecords( blockId, NORMAL ); String[] readBack = (String[]) store.getArrayFor( store.getRecords( blockId, NORMAL ) ); assertEquals( 0, readBack.length ); Collection<DynamicRecord> records = store.getRecords( blockId, NORMAL ); for ( DynamicRecord record : records ) { record.setInUse( false ); store.updateRecord( record ); } } }
@Test public void testClose() { DynamicArrayStore store = createDynamicArrayStore(); Collection<DynamicRecord> records = new ArrayList<>(); store.allocateRecordsFromBytes( records, new byte[10] ); long blockId = Iterables.first( records ).getId(); for ( DynamicRecord record : records ) { store.updateRecord( record ); } neoStores.close(); neoStores = null; try { store.getArrayFor( store.getRecords( blockId, NORMAL ) ); fail( "Closed store should throw exception" ); } catch ( RuntimeException e ) { // good } try { store.getRecords( 0, NORMAL ); fail( "Closed store should throw exception" ); } catch ( RuntimeException e ) { // good } }
@Test public void testAddDeleteSequenceEmptyNumberArray() { DynamicArrayStore store = createDynamicArrayStore(); byte[] emptyToWrite = createBytes( 0 ); long blockId = create( store, emptyToWrite ); store.getRecords( blockId, NORMAL ); byte[] bytes = (byte[]) store.getArrayFor( store.getRecords( blockId, NORMAL ) ); assertEquals( 0, bytes.length ); Collection<DynamicRecord> records = store.getRecords( blockId, NORMAL ); for ( DynamicRecord record : records ) { record.setInUse( false ); store.updateRecord( record ); } }