protected static void waitUntilArchivingIsDone( DummyArchiver archiver, int expectedStoreSize ) throws Exception
    {
        final Instant start = Instant.now();

        while ( archiver.store.size() < expectedStoreSize ) {
            if ( Duration.between( start, Instant.now() ).compareTo( archiver.getMaxPurgeInterval().multipliedBy( 10 ) ) > 0 ) {
                throw new IllegalStateException( "Failsafe triggered: test is taking to long." );
            }
            Thread.sleep( 10 );
        }
    }
A utility method that blocks until the archiver should reasonably have finished storing data.

@param archiver The archiver to wait for.
@param expectedStoreSize The amount of data elements that are expected to have been written to store.
xmppserver/src/test/java/org/jivesoftware/openfire/archive/ArchiverTest.java