MetadataExtractor { public long extractResultAvailableAfter( Map<String,Value> metadata ) { Value resultAvailableAfterValue = metadata.get( resultAvailableAfterMetadataKey ); if ( resultAvailableAfterValue != null ) { return resultAvailableAfterValue.asLong(); } return -1; } MetadataExtractor( String resultAvailableAfterMetadataKey, String resultConsumedAfterMetadataKey ); QueryKeys extractQueryKeys( Map<String,Value> metadata ); long extractQueryId( Map<String,Value> metadata ); long extractResultAvailableAfter( Map<String,Value> metadata ); ResultSummary extractSummary(Query query, Connection connection, long resultAvailableAfter, Map<String,Value> metadata ); static DatabaseInfo extractDatabaseInfo( Map<String,Value> metadata ); static Bookmark extractBookmarks( Map<String,Value> metadata ); static ServerVersion extractNeo4jServerVersion( Map<String,Value> metadata ); static final int ABSENT_QUERY_ID; }
@Test void shouldExtractResultAvailableAfter() { Map<String,Value> metadata = singletonMap( RESULT_AVAILABLE_AFTER_KEY, value( 424242 ) ); long extractedResultAvailableAfter = extractor.extractResultAvailableAfter( metadata ); assertEquals( 424242L, extractedResultAvailableAfter ); }
@Test void shouldExtractNoResultAvailableAfterWhenNoneInMetadata() { long extractedResultAvailableAfter = extractor.extractResultAvailableAfter( emptyMap() ); assertEquals( -1, extractedResultAvailableAfter ); }