### Question:
AbstractKeyValueStore extends LifecycleAdapter { protected final PreparedRotation prepareRotation( final long version ) { try ( LockWrapper ignored = writeLock( updateLock, logger ) ) { ProgressiveState<Key> prior = state; if ( prior.storedVersion() == version && !prior.hasChanges() ) { return () -> version; } return new RotationTask( version ); } } AbstractKeyValueStore( FileSystemAbstraction fs, PageCache pages, DatabaseLayout databaseLayout, RotationMonitor monitor, Logger logger,
            RotationTimerFactory timerFactory, VersionContextSupplier versionContextSupplier, int keySize,
            int valueSize, HeaderField<?>... headerFields ); @Override String toString(); int totalEntriesStored(); final File currentFile(); @Override final void init(); @Override final void start(); @Override final void shutdown(); Iterable<File> allFiles();  }### Answer:
@Test @Resources.Life( STARTED ) public void shouldRotateStore() throws Exception { Store store = resourceManager.managed( new Store() ); store.prepareRotation( 0 ).rotate(); }
@Test @Resources.Life( STARTED ) public void shouldStoreEntries() throws Exception { Store store = resourceManager.managed( new Store() ); store.put( "message", "hello world" ); store.put( "age", "too old" ); assertEquals( "hello world", store.get( "message" ) ); assertEquals( "too old", store.get( "age" ) ); store.prepareRotation( 0 ).rotate(); assertEquals( "hello world", store.get( "message" ) ); assertEquals( "too old", store.get( "age" ) ); }
@Test @Resources.Life( STARTED ) public void postStateUpdatesCountedOnlyForTransactionsGreaterThanRotationVersion() throws IOException, InterruptedException, ExecutionException { final Store store = resourceManager.managed( createTestStore() ); PreparedRotation rotation = store.prepareRotation( 2 ); updateStore( store, 4 ); updateStore( store, 3 ); updateStore( store, 1 ); updateStore( store, 2 ); assertEquals( 2, rotation.rotate() ); Future<Long> rotationFuture = threading.executeAndAwait( store.rotation, 5L, thread -> Thread.State.TIMED_WAITING == thread.getState(), 100, SECONDS ); Thread.sleep( TimeUnit.SECONDS.toMillis( 1 ) ); assertFalse( rotationFuture.isDone() ); updateStore( store, 5 ); assertEquals( 5, rotationFuture.get().longValue() ); }
@Test @Resources.Life( STARTED ) public void shouldFailRotationAfterTimeout() throws IOException { final Store store = resourceManager.managed( createTestStore( 0 ) ); expectedException.expect( RotationTimeoutException.class ); store.prepareRotation( 10L ).rotate(); }