Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void createReadOnlyIndexReference() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CreateReadOnlyIndexReference()
        {
            ReadOnlyIndexReferenceFactory indexReferenceFactory = ReadOnlyIndexReferenceFactory;
            IndexReference indexReference = indexReferenceFactory.CreateIndexReference(_indexIdentifier);

            _cleanupRule.add(indexReference);

            _expectedException.expect(typeof(System.NotSupportedException));
            indexReference.Writer;
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void refreshChangedWritableIndexReference() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void RefreshChangedWritableIndexReference()
        {
            WritableIndexReferenceFactory indexReferenceFactory = CreateFactory();
            IndexReference indexReference = CreateIndexReference(indexReferenceFactory);

            WriteSomething(indexReference);

            IndexReference refreshedIndexReference = indexReferenceFactory.Refresh(indexReference);

            _cleanupRule.add(refreshedIndexReference);

            assertNotSame("Should return new refreshed index reference.", indexReference, refreshedIndexReference);
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToRestartServer() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToRestartServer()
        {
            // Given
            string dataDirectory1 = _baseDir.directory("data1").AbsolutePath;
            string dataDirectory2 = _baseDir.directory("data2").AbsolutePath;

            Config config = Config.fromFile(EnterpriseServerBuilder.serverOnRandomPorts().withDefaultDatabaseTuning().usingDataDir(dataDirectory1).createConfigFiles()).withHome(_baseDir.directory()).withSetting(GraphDatabaseSettings.logs_directory, _baseDir.directory("logs").Path).build();

            // When
            NeoServer server = _cleanup.add(new OpenEnterpriseNeoServer(config, GraphDbDependencies()));

            server.Start();

            assertNotNull(server.Database.Graph);
            assertEquals(config.Get(GraphDatabaseSettings.database_path).AbsolutePath, server.Database.Location.AbsolutePath);

            // Change the database location
            config.Augment(GraphDatabaseSettings.data_directory, dataDirectory2);
            ServerManagement bean = new ServerManagement(server);

            bean.RestartServer();

            // Then
            assertNotNull(server.Database.Graph);
            assertEquals(config.Get(GraphDatabaseSettings.database_path).AbsolutePath, server.Database.Location.AbsolutePath);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHaveOneThreadWaitForARemoval() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHaveOneThreadWaitForARemoval()
        {
            // GIVEN
            IdOrderingQueue queue = new SynchronizedArrayIdOrderingQueue(5);

            queue.Offer(3);
            queue.Offer(5);

            // WHEN another thread comes in and awaits 5
            OtherThreadExecutor <Void> t2     = Cleanup.add(new OtherThreadExecutor <Void>("T2", null));
            Future <object>            await5 = t2.ExecuteDontWait(AwaitHead(queue, 5));

            t2.WaitUntilWaiting();
            // ... and head (3) gets removed
            queue.RemoveChecked(3);

            // THEN the other thread should be OK to continue
            await5.get();
        }
Esempio n. 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: ");
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldStopDatabaseWhenOutOfDiskSpace() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldStopDatabaseWhenOutOfDiskSpace()
        {
            // Given
            TransactionFailureException expectedCommitException = null;
            TransactionFailureException expectedStartException  = null;
            File storeDir = TestDirectory.absolutePath();
            LimitedFileSystemGraphDatabase db = Cleanup.add(new LimitedFileSystemGraphDatabase(storeDir));

            using (Transaction tx = Db.beginTx())
            {
                Db.createNode();
                tx.Success();
            }

            long logVersion = Db.DependencyResolver.resolveDependency(typeof(LogVersionRepository)).CurrentLogVersion;

            Db.runOutOfDiskSpaceNao();

            try
            {
                using (Transaction tx = Db.beginTx())
                {
                    Db.createNode();
                    tx.Success();
                }
            }
            catch (TransactionFailureException e)
            {
                expectedCommitException = e;
            }
            finally
            {
                assertNotNull("Expected tx finish to throw TransactionFailureException when filesystem is full.", expectedCommitException);
            }

            // When
            try
            {
                using (Transaction transaction = Db.beginTx())
                {
                    fail("Expected tx begin to throw TransactionFailureException when tx manager breaks.");
                }
            }
            catch (TransactionFailureException e)
            {
                expectedStartException = e;
            }
            finally
            {
                assertNotNull("Expected tx begin to throw TransactionFailureException when tx manager breaks.", expectedStartException);
            }

            // Then
            Db.somehowGainMoreDiskSpace();               // to help shutting down the db
            Db.shutdown();

            PageCache pageCache = PageCacheRule.getPageCache(Db.FileSystem);
            File      neoStore  = TestDirectory.databaseLayout().metadataStore();

            assertEquals(logVersion, MetaDataStore.getRecord(pageCache, neoStore, MetaDataStore.Position.LOG_VERSION));
        }