예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void notificationInLogAboutFileDeletion()
        public virtual void NotificationInLogAboutFileDeletion()
        {
            AssertableLogProvider            internalLogProvider = new AssertableLogProvider(false);
            DefaultFileDeletionEventListener listener            = BuildListener(internalLogProvider);

            listener.FileDeleted("testFile.db");
            listener.FileDeleted("anotherDirectory");

            internalLogProvider.RawMessageMatcher().assertContains("'testFile.db' which belongs to the store was deleted while database was running.");
            internalLogProvider.RawMessageMatcher().assertContains("'anotherDirectory' which belongs to the store was deleted while database was running.");
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCountFileSizeRecursively() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCountFileSizeRecursively()
        {
            // file structure:
            //   storeDir/indexDir/indexFile (1 kB)
            //   storeDir/neostore (3 kB)
            File           storeDir = DirectoryConflict.directory("storeDir");
            DatabaseLayout layout   = DatabaseLayout.of(storeDir);
            File           indexDir = Directory(storeDir, "indexDir");

            File(indexDir, "indexFile", ( int )kibiBytes(1));
            File(storeDir, layout.MetadataStore().Name, (int)kibiBytes(3));

            AssertableLogProvider logProvider = new AssertableLogProvider();

            KernelDiagnostics.StoreFiles storeFiles = new KernelDiagnostics.StoreFiles(layout);
            storeFiles.Dump(logProvider.getLog(this.GetType()).debugLogger());

            logProvider.RawMessageMatcher().assertContains("Total size of store: 4.00 kB");
            logProvider.RawMessageMatcher().assertContains("Total size of mapped files: 3.00 kB");
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPrintDiskUsage()
        public virtual void ShouldPrintDiskUsage()
        {
            // Not sure how to get around this w/o spying. The method that we're unit testing will construct
            // other File instances with this guy as parent and internally the File constructor uses the field 'path'
            // which, if purely mocked, won't be assigned. At the same time we want to control the total/free space methods
            // and what they return... a tough one.
            File           storeDir = Mockito.spy(new File("storeDir"));
            DatabaseLayout layout   = mock(typeof(DatabaseLayout));

            when(layout.DatabaseDirectory()).thenReturn(storeDir);
            when(storeDir.TotalSpace).thenReturn(100L);
            when(storeDir.FreeSpace).thenReturn(40L);

            AssertableLogProvider logProvider = new AssertableLogProvider();

            KernelDiagnostics.StoreFiles storeFiles = new KernelDiagnostics.StoreFiles(layout);
            storeFiles.Dump(logProvider.getLog(this.GetType()).debugLogger());

            logProvider.RawMessageMatcher().assertContains("100 / 40 / 40");
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotDuplicateToAnyLog()
        public virtual void ShouldNotDuplicateToAnyLog()
        {
            AssertableLogProvider userLogProvider  = new AssertableLogProvider();
            AssertableLogProvider debugLogProvider = new AssertableLogProvider();

            SimpleLogService logService = new SimpleLogService(userLogProvider, debugLogProvider);

            Monitors monitors = new Monitors();

            CoreMonitor.Register(logService.InternalLogProvider, logService.UserLogProvider, monitors);

            ClusterBinder.Monitor monitor = monitors.NewMonitor(typeof(ClusterBinder.Monitor));

            ClusterId clusterId = new ClusterId(System.Guid.randomUUID());

            monitor.BoundToCluster(clusterId);

            userLogProvider.RawMessageMatcher().assertContainsSingle(Matchers.allOf(Matchers.containsString("Bound to cluster with id " + clusterId.Uuid())));

            debugLogProvider.RawMessageMatcher().assertContainsSingle(Matchers.allOf(Matchers.containsString("Bound to cluster with id " + clusterId.Uuid())));
        }
예제 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSeeExpectedDiagnostics()
        public virtual void ShouldSeeExpectedDiagnostics()
        {
            AssertableLogProvider logProvider = new AssertableLogProvider();
            GraphDatabaseService  db          = (new TestGraphDatabaseFactory()).setInternalLogProvider(logProvider).newImpermanentDatabaseBuilder().setConfig(GraphDatabaseSettings.dump_configuration, Settings.TRUE).setConfig(GraphDatabaseSettings.pagecache_memory, "4M").newGraphDatabase();

            CleanupRule.add(db);

            // THEN we should have logged
            logProvider.RawMessageMatcher().assertContains("Network information");
            logProvider.RawMessageMatcher().assertContains("Disk space on partition");
            logProvider.RawMessageMatcher().assertContains("Local timezone");
            // page cache info
            logProvider.RawMessageMatcher().assertContains("Page cache: 4M");
            // neostore records
            foreach (MetaDataStore.Position position in MetaDataStore.Position.values())
            {
                logProvider.RawMessageMatcher().assertContains(position.name());
            }
            // transaction log info
            logProvider.RawMessageMatcher().assertContains("Transaction log");
            logProvider.RawMessageMatcher().assertContains("TimeZone version: ");
        }