DiagnosticsReportCommand( Path homeDir, Path configDir, OutsideWorld outsideWorld ) { this.homeDir = homeDir; this.configDir = configDir; this.fs = outsideWorld.fileSystem(); this.out = outsideWorld.outStream(); err = outsideWorld.errorStream(); }
@Test void listShouldDisplayAllClassifiers() throws Exception { try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) { PrintStream ps = new PrintStream( baos ); String[] args = {"--list"}; OutsideWorld outsideWorld = mock( OutsideWorld.class ); when( outsideWorld.fileSystem() ).thenReturn( fs ); when( outsideWorld.outStream() ).thenReturn( ps ); DiagnosticsReportCommand diagnosticsReportCommand = new DiagnosticsReportCommand( homeDir, configDir, outsideWorld ); diagnosticsReportCommand.execute( args ); assertThat( baos.toString(), is(String.format( "Finding running instance of neo4j%n" + "No running instance of neo4j was found. Online reports will be omitted.%n" + "If neo4j is running but not detected, you can supply the process id of the running instance with --pid%n" + "All available classifiers:%n" + " config include configuration file%n" + " logs include log files%n" + " plugins include a view of the plugin directory%n" + " ps include a list of running processes%n" + " tree include a view of the tree structure of the data directory%n" + " tx include transaction logs%n" ) ) ); } }
BackupOutputMonitor( OutsideWorld outsideWorld ) { LogProvider stdOutLogProvider = FormattedLogProvider.toOutputStream( outsideWorld.outStream() ); log = stdOutLogProvider.getLog( BackupOutputMonitor.class ); }
DiagnosticsReportCommand( Path homeDir, Path configDir, OutsideWorld outsideWorld ) { this.homeDir = homeDir; this.configDir = configDir; this.fs = outsideWorld.fileSystem(); this.out = outsideWorld.outStream(); err = outsideWorld.errorStream(); }
@Override @Nonnull public AdminCommand create( Path homeDir, Path configDir, OutsideWorld outsideWorld ) { boolean debug = System.getenv().get( "NEO4J_DEBUG") != null; LogProvider logProvider = FormattedLogProvider.withDefaultLogLevel( debug ? Level.DEBUG : Level.NONE ).toOutputStream( outsideWorld.outStream() ); Monitors monitors = new Monitors(); OnlineBackupContextBuilder contextBuilder = new OnlineBackupContextBuilder( homeDir, configDir ); BackupModule backupModule = new BackupModule( outsideWorld, logProvider, monitors ); BackupSupportingClassesFactoryProvider classesFactoryProvider = getProvidersByPriority().findFirst().orElseThrow( noProviderException() ); BackupSupportingClassesFactory supportingClassesFactory = classesFactoryProvider.getFactory( backupModule ); BackupStrategyCoordinatorFactory coordinatorFactory = new BackupStrategyCoordinatorFactory( backupModule ); return new OnlineBackupCommand( outsideWorld, contextBuilder, supportingClassesFactory, coordinatorFactory ); }
protected BackupSupportingClassesFactory( BackupModule backupModule ) { this.logProvider = backupModule.getLogProvider(); this.clock = backupModule.getClock(); this.monitors = backupModule.getMonitors(); this.fileSystemAbstraction = backupModule.getFileSystemAbstraction(); this.transactionLogCatchUpFactory = backupModule.getTransactionLogCatchUpFactory(); this.logDestination = backupModule.getOutsideWorld().outStream(); this.outsideWorld = backupModule.getOutsideWorld(); }