@Override public Log getLog( String name ) { return NullLog.getInstance(); } }
@Override public Log getLog( Class loggingClass ) { return NullLog.getInstance(); }
public OnDemandDetailsExecutionMonitor( PrintStream out, InputStream in, Monitor monitor, JobScheduler jobScheduler ) { this.out = out; this.in = in; this.monitor = monitor; this.actions.put( "i", Pair.of( "Print more detailed information", this::printDetails ) ); this.actions.put( "c", Pair.of( "Print more detailed information about current stage", this::printDetailsForCurrentStage ) ); this.vmPauseMonitor = new VmPauseMonitor( Duration.ofMillis( 100 ), Duration.ofMillis( 100 ), NullLog.getInstance(), jobScheduler, vmPauseTimeAccumulator ); }
public Procedures( EmbeddedProxySPI proxySPI, ThrowingConsumer<Procedures,ProcedureException> builtin, File pluginDir, Log log, ProcedureConfig config ) { this.builtin = builtin; this.pluginDir = pluginDir; this.log = log; this.typeMappers = new TypeMappers( proxySPI ); this.compiler = new ReflectiveProcedureCompiler( typeMappers, safeComponents, allComponents, log, config ); }
private static void dump( DiagnosticsProvider provider, DiagnosticsPhase phase, Log log ) { // Optimization to skip diagnostics dumping (which is time consuming) if there's no log anyway. // This is first and foremost useful for speeding up testing. if ( log == NullLog.getInstance() ) { return; } try { provider.dump( phase, log.infoLogger() ); } catch ( Exception cause ) { log.error( "Failure while logging diagnostics for " + provider, cause ); } }
private static PageCache getOrCreatePageCache( Config config, FileSystemAbstraction fs, JobScheduler jobScheduler ) { Log log = NullLog.getInstance(); ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory( fs, config, NULL, PageCursorTracerSupplier.NULL, log, EmptyVersionContextSupplier.EMPTY, jobScheduler ); return pageCacheFactory.getOrCreatePageCache(); } }
private static TransactionStateMachineV1SPI createTxSpi( Supplier<TransactionIdStore> txIdStore, Duration txAwaitDuration, Clock clock ) { DatabaseAvailabilityGuard databaseAvailabilityGuard = new DatabaseAvailabilityGuard( DEFAULT_DATABASE_NAME, clock, NullLog.getInstance() ); return createTxSpi( txIdStore, txAwaitDuration, databaseAvailabilityGuard, clock ); }
@Before public void setUp() { databaseAvailabilityGuard = new DatabaseAvailabilityGuard( DEFAULT_DATABASE_NAME, clock, NullLog.getInstance() ); }
private static DatabaseHealth getDatabaseHealth() { DatabasePanicEventGenerator databasePanicEventGenerator = new DatabasePanicEventGenerator( new KernelEventHandlers( NullLog.getInstance() ) ); return new DatabaseHealth( databasePanicEventGenerator, NullLog.getInstance() ); }
@Test public void testCtorParametersValidation() { assertThatFails( NullPointerException.class, () -> new VmPauseMonitor( ofSeconds( 1 ), ofSeconds( 1 ), null, jobScheduler, listener ) ); assertThatFails( NullPointerException.class, () -> new VmPauseMonitor( ofSeconds( 1 ), ofSeconds( 1 ), NullLog.getInstance(), null, listener ) ); assertThatFails( NullPointerException.class, () -> new VmPauseMonitor( ofSeconds( 1 ), ofSeconds( 1 ), NullLog.getInstance(), jobScheduler, null ) ); assertThatFails( IllegalArgumentException.class, () -> new VmPauseMonitor( ofSeconds( 0 ), ofSeconds( 1 ), NullLog.getInstance(), jobScheduler, listener ) ); assertThatFails( IllegalArgumentException.class, () -> new VmPauseMonitor( ofSeconds( 1 ), ofSeconds( -1 ), NullLog.getInstance(), jobScheduler, listener ) ); assertThatFails( IllegalArgumentException.class, () -> new VmPauseMonitor( ofSeconds( -1 ), ofSeconds( 1 ), NullLog.getInstance(), jobScheduler, listener ) ); }
@Test public void shouldNotPropagateExceptionCaught() throws Exception { ChannelInboundHandler next = mock( ChannelInboundHandler.class ); BoltConnection connection = mock( BoltConnection.class ); channel = new EmbeddedChannel( new HouseKeeper( connection, NullLog.getInstance() ), next ); channel.pipeline().fireExceptionCaught( new RuntimeException( "some exception" ) ); verify( next, never() ).exceptionCaught( any(), any() ); }
@Test public void shouldNotPropagateChannelInactive() throws Exception { ChannelInboundHandler next = mock( ChannelInboundHandler.class ); BoltConnection connection = mock( BoltConnection.class ); channel = new EmbeddedChannel( new HouseKeeper( connection, NullLog.getInstance() ), next ); channel.pipeline().fireChannelInactive(); verify( next, never() ).channelInactive( any() ); }
@Test void shouldPullTheResult() throws Exception { BoltResponseMessageRecorder messageWriter = new BoltResponseMessageRecorder(); ResultHandler handler = new ResultHandler( messageWriter, mock( BoltConnection.class ), NullLog.getInstance() ); ImmutableRecord record1 = new ImmutableRecord( values( "a", "b", "c" ) ); ImmutableRecord record2 = new ImmutableRecord( values( "1", "2", "3" ) ); BoltResult result = new TestBoltResult( record1, record2 ); handler.onRecords( result, true ); handler.onFinish(); List<ResponseMessage> messages = messageWriter.asList(); assertThat( messages.size(), equalTo( 3 ) ); assertThat( messages.get( 0 ), equalTo( new RecordMessage( record1 ) ) ); assertThat( messages.get( 1 ), equalTo( new RecordMessage( record2 ) ) ); assertThat( messages.get( 2 ), instanceOf( SuccessMessage.class ) ); }
@Test public void shouldStopConnectionOnExceptionCaught() { BoltConnection connection = mock( BoltConnection.class ); channel = new EmbeddedChannel( new HouseKeeper( connection, NullLog.getInstance() ) ); channel.pipeline().fireExceptionCaught( new RuntimeException( "some exception" ) ); verify( connection ).stop(); }
@Test public void givenAccessGuardWithConditionWhenShutdownThenInstantlyDenyAccess() { // Given Clock clock = Mockito.mock( Clock.class ); final DatabaseAvailabilityGuard databaseAvailabilityGuard = getDatabaseAvailabilityGuard( clock, NullLog.getInstance() ); databaseAvailabilityGuard.require( REQUIREMENT_1 ); // When databaseAvailabilityGuard.shutdown(); // Then assertFalse( databaseAvailabilityGuard.isAvailable( 1000 ) ); verifyZeroInteractions( clock ); }
@Test void shouldDiscardTheResult() throws Exception { BoltResponseMessageRecorder messageWriter = new BoltResponseMessageRecorder(); ResultHandler handler = new ResultHandler( messageWriter, mock( BoltConnection.class ), NullLog.getInstance() ); ImmutableRecord record1 = new ImmutableRecord( values( "a", "b", "c" ) ); ImmutableRecord record2 = new ImmutableRecord( values( "1", "2", "3" ) ); BoltResult result = new TestBoltResult( record1, record2 ); handler.onRecords( result, false ); handler.onFinish(); List<ResponseMessage> messages = messageWriter.asList(); assertThat( messages.size(), equalTo( 1 ) ); assertThat( messages.get( 0 ), instanceOf( SuccessMessage.class ) ); }
@Test public void testNoMigration() { assertThat( migrator.apply( stringMap( "foo", "bar" ), NullLog.getInstance() ), equalTo( stringMap( "foo", "bar" ) ) ); logProvider.assertNoLoggingOccurred(); }
@Test public void shouldFitAsManyPagesAsItCan() { // Given long pageCount = 60; long memory = MuninnPageCache.memoryRequiredForPages( pageCount ); Config config = Config.defaults( pagecache_memory, Long.toString( memory ) ); // When ConfiguringPageCacheFactory factory = new ConfiguringPageCacheFactory( fsRule.get(), config, PageCacheTracer.NULL, PageCursorTracerSupplier.NULL, NullLog.getInstance(), EmptyVersionContextSupplier.EMPTY, jobScheduler ); // Then try ( PageCache cache = factory.getOrCreatePageCache() ) { assertThat( cache.pageSize(), equalTo( PageCache.PAGE_SIZE ) ); assertThat( cache.maxCachedPages(), equalTo( pageCount ) ); } }
@Test public void shouldStopConnectionOnChannelInactive() { BoltConnection connection = mock( BoltConnection.class ); channel = new EmbeddedChannel( new HouseKeeper( connection, NullLog.getInstance() ) ); channel.pipeline().fireChannelInactive(); verify( connection ).stop(); }
@Before public void setUp() { components = new ComponentRegistry(); procedureCompiler = new ReflectiveProcedureCompiler( new TypeMappers(), components, components, NullLog.getInstance(), ProcedureConfig.DEFAULT ); }