@BeforeClass public static void setupServer() throws IOException { out = new ByteArrayOutputStream(); server = ServerHelper.createNonPersistentServer( FormattedLogProvider.toOutputStream( out ) ); }
private GraphDatabaseDependencies dependencies = GraphDatabaseDependencies.newDependencies(); private Log log = FormattedLogProvider.toOutputStream( System.out ).getLog( getClass() ); private String serverAddress = "unknown address";
@Test void shouldReturnSameLoggerForSameClass() { // Given FormattedLogProvider logProvider = FormattedLogProvider.toOutputStream( new ByteArrayOutputStream() ); // Then FormattedLog log = logProvider.getLog( getClass() ); assertThat( logProvider.getLog( FormattedLogProviderTest.class ), sameInstance( log ) ); }
@Test void shouldReturnSameLoggerForSameContext() { // Given FormattedLogProvider logProvider = FormattedLogProvider.toOutputStream( new ByteArrayOutputStream() ); // Then FormattedLog log = logProvider.getLog( "test context" ); assertThat( logProvider.getLog( "test context" ), sameInstance( log ) ); }
public static void main( String[] args ) throws Exception { Args arg = Args.withFlags( HEAP ).parse( args == null ? new String[0] : args ); boolean doHeapDump = arg.getBoolean( HEAP, false, true ); String[] containing = arg.orphans().toArray( new String[arg.orphans().size()] ); String dumpDir = arg.get( DIR, "data" ); new DumpProcessInformation( FormattedLogProvider.toOutputStream( System.out ), new File( dumpDir ) ).dumpRunningProcesses( doHeapDump, containing ); }
private PageCache createPageCache( FileSystemAbstraction fs, PageCacheConfig pageCacheConfig, Config config ) { PageCacheTracer tracer = selectConfig( baseConfig.tracer, pageCacheConfig.tracer, PageCacheTracer.NULL ); PageCursorTracerSupplier cursorTracerSupplier = selectConfig( baseConfig.pageCursorTracerSupplier, pageCacheConfig.pageCursorTracerSupplier, PageCursorTracerSupplier.NULL ); config.augmentDefaults( GraphDatabaseSettings.pagecache_memory, "8M" ); FormattedLogProvider logProvider = FormattedLogProvider.toOutputStream( System.err ); initializeJobScheduler(); ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory( fs, config, tracer, cursorTracerSupplier, logProvider.getLog( PageCache.class ), EmptyVersionContextSupplier.EMPTY, jobScheduler ); return pageCacheFactory.getOrCreatePageCache(); } }
private void assertDatabaseConsistent() { LogProvider logProvider = FormattedLogProvider.toOutputStream( System.out ); try { ConsistencyCheckService.Result result = new ConsistencyCheckService().runFullConsistencyCheck( testDirectory.databaseLayout(), Config.defaults(), ProgressMonitorFactory.textual( System.err ), logProvider, false ); assertTrue( result.isSuccessful() ); } catch ( ConsistencyCheckIncompleteException e ) { fail( e.getMessage() ); } } }
Config config = Config.defaults( GraphDatabaseSettings.pagecache_memory, "8m" ); consistencyCheckService.runFullConsistencyCheck( testDirectory.databaseLayout(), config, ProgressMonitorFactory.NONE, FormattedLogProvider.toOutputStream( System.out ), false );
/** * The test case is basically loads of concurrent CREATE/DELETE NODE or sometimes just CREATE, keeping the created node in an array * for dedicated deleter threads to pick up and delete as fast as they can see them. This concurrently with large creation transactions. */ @Test public void shouldStressIt() throws Throwable { // given Race race = new Race().withMaxDuration( 5, TimeUnit.SECONDS ); AtomicReferenceArray<Node> nodeHeads = new AtomicReferenceArray<>( NUMBER_OF_CREATORS ); for ( int i = 0; i < NUMBER_OF_CREATORS; i++ ) { race.addContestant( creator( nodeHeads, i ) ); } race.addContestants( NUMBER_OF_DELETORS, deleter( nodeHeads ) ); // when race.go(); // then DatabaseLayout dbLayout = db.databaseLayout(); db.shutdownAndKeepStore(); assertTrue( new ConsistencyCheckService().runFullConsistencyCheck( dbLayout, defaults(), NONE, toOutputStream( System.out ), false, new ConsistencyFlags( true, true, true, false ) ).isSuccessful() ); }
BackupOutputMonitor( OutsideWorld outsideWorld ) { LogProvider stdOutLogProvider = FormattedLogProvider.toOutputStream( outsideWorld.outStream() ); log = stdOutLogProvider.getLog( BackupOutputMonitor.class ); }
public CypherQueryExecutor(GraphDatabaseService gdb) { this.gdb = gdb; DependencyResolver dependencyResolver = ((GraphDatabaseAPI) gdb).getDependencyResolver(); threadToStatementContextBridge = dependencyResolver.resolveDependency(ThreadToStatementContextBridge.class); FormattedLogProvider logProvider = FormattedLogProvider.toOutputStream(System.out); }
public static synchronized StatContext create( String name, long printEvery, boolean clearAfterPrint ) { return create( name, toOutputStream( System.out ).getLog( name ), printEvery, clearAfterPrint ); }
public static synchronized StatContext create( String name, long printEvery, boolean clearAfterPrint ) { return create( name, toOutputStream( System.out ).getLog( name ), printEvery, clearAfterPrint ); }
public BackupProtocolService( OutputStream logDestination ) { this( DefaultFileSystemAbstraction::new, FormattedLogProvider.toOutputStream( logDestination ), logDestination, new Monitors(), createPageCache( new DefaultFileSystemAbstraction() ) ); }
public static void main( String[] args ) { try { Path clusterPath = Files.createTempDirectory( "causal-cluster" ); System.out.println( "clusterPath = " + clusterPath ); CausalClusterInProcessBuilder.CausalCluster cluster = CausalClusterInProcessBuilder.init() .withCores( 3 ) .withReplicas( 3 ) .withLogger( toOutputStream( System.out ) ) .atPath( clusterPath ) .build(); System.out.println( "Waiting for cluster to boot up..." ); cluster.boot(); System.out.println( "Press ENTER to exit..." ); //noinspection ResultOfMethodCallIgnored System.in.read(); System.out.println( "Shutting down..." ); cluster.shutdown(); } catch ( Throwable e ) { e.printStackTrace(); System.exit( -1 ); } System.exit( 0 ); }
public static void main( String[] args ) { try { Path clusterPath = Files.createTempDirectory( "causal-cluster" ); System.out.println( "clusterPath = " + clusterPath ); CausalClusterInProcessBuilder.CausalCluster cluster = CausalClusterInProcessBuilder.init() .withCores( 6 ) .withReplicas( 4 ) .withLogger( toOutputStream( System.out ) ) .atPath( clusterPath ) .withOptionalDatabases( Arrays.asList("foo", "bar") ) .build(); System.out.println( "Waiting for cluster to boot up..." ); cluster.boot(); System.out.println( "Press ENTER to exit ..." ); //noinspection ResultOfMethodCallIgnored System.in.read(); System.out.println( "Shutting down..." ); cluster.shutdown(); } catch ( Throwable e ) { e.printStackTrace(); System.exit( -1 ); } System.exit( 0 ); }
private GraphDatabaseDependencies dependencies = GraphDatabaseDependencies.newDependencies(); private Log log = FormattedLogProvider.toOutputStream( System.out ).getLog( getClass() ); private String serverAddress = "unknown address";
public DirectStoreAccess directStoreAccess() { if ( directStoreAccess == null ) { DefaultFileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(); PageCache pageCache = getPageCache( fileSystem ); StoreAccess nativeStores = new StoreAccess( fileSystem, pageCache, directory ).initialize(); Config config = new Config(); OperationalMode operationalMode = OperationalMode.single; directStoreAccess = new DirectStoreAccess( nativeStores, new LuceneLabelScanStoreBuilder( directory, nativeStores.getRawNeoStores(), fileSystem, config, operationalMode, FormattedLogProvider.toOutputStream( System.out ) ).build(), createIndexes( fileSystem, config, operationalMode ) ); } return directStoreAccess; }