integration-tests/src/test/java/com/kdgregory/aws/utils/CloudWatchLogsIntegrationTest.java
/**
     *  A spin-loop that waits for records to become available in a stream,
     *  throwing if they're not there within 30 seconds.
     *
     *  Re-creates what the classes-under-test do, but as a separate implementation
     *  so that we know we're not just believing our own bullshit.
     */
A spin-loop that waits for records to become available in a stream,
throwing if they're not there within 30 seconds.

Re-creates what the classes-under-test do, but as a separate implementation
so that we know we're not just believing our own bullshit.
A spin - loop that waits for records to become available in a stream throwing if they ' re not there within 30 seconds . Re - creates what the classes - under - test do but as a separate implementation so that we know we ' re not just believing our own bullshit .
private void waitForRecords(String logGroupName, String logStreamName)
    {
        long timeout = System.currentTimeMillis() + 30000;
        while (System.currentTimeMillis() < timeout)
        {
            GetLogEventsRequest request = new GetLogEventsRequest(logGroupName, logStreamName);
            GetLogEventsResult result = client.getLogEvents(request);
            if (CollectionUtil.isNotEmpty(result.getEvents()))
                return;
            ThreadUtil.sleepQuietly(250);
        }
        throw new IllegalStateException("records did not appear in stream before timeout");
    }
private void waitForRecords ( String logGroupName , String logStreamName ) { long timeout = System . currentTimeMillis ( ) + 30000 ; while ( System . currentTimeMillis ( ) < timeout ) { GetLogEventsRequest request = new GetLogEventsRequest ( logGroupName , logStreamName ) ; GetLogEventsResult result = client . getLogEvents ( request ) ; if ( CollectionUtil . isNotEmpty ( result . getEvents ( ) ) ) return ; ThreadUtil . sleepQuietly ( 250 ) ; } throw new IllegalStateException ( "records did not appear in stream before timeout" ) ; }
A spin-loop that waits for records to become available in a stream,
  throwing if they're not there within 30 seconds.
A spin - loop that waits for records to become available in a stream throwing if they ' re not there within 30 seconds .