//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void runTest(int nodeCount, int run, boolean multiThreaded) throws Exception
        private void RunTest(int nodeCount, int run, bool multiThreaded)
        {
            // WHEN creating the indexes under stressful updates
            PopulateDbAndIndexes(nodeCount, multiThreaded);
            ConsistencyCheckService cc = new ConsistencyCheckService();

            ConsistencyCheckService.Result result = cc.RunFullConsistencyCheck(_directory.databaseLayout(), Config.defaults(GraphDatabaseSettings.pagecache_memory, "8m"), NONE, NullLogProvider.Instance, false);
            assertTrue(result.Successful);
            DropIndexes();
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void populateDbWithConcurrentUpdates() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PopulateDbWithConcurrentUpdates()
        {
            GraphDatabaseService database = (new TestGraphDatabaseFactory()).newEmbeddedDatabase(_testDirectory.databaseDir());

            try
            {
                RandomValues randomValues = RandomValues.create();
                int          counter      = 1;
                for (int j = 0; j < 100; j++)
                {
                    using (Transaction transaction = database.BeginTx())
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            Node node = database.CreateNode(Label.label("label" + counter));
                            node.SetProperty("property", randomValues.NextValue().asObject());
                        }
                        transaction.Success();
                    }
                    counter++;
                }

                int             populatorCount = 5;
                ExecutorService executor       = Executors.newFixedThreadPool(populatorCount);
                System.Threading.CountdownEvent startSignal = new System.Threading.CountdownEvent(1);
                AtomicBoolean endSignal = new AtomicBoolean();
                for (int i = 0; i < populatorCount; i++)
                {
                    executor.submit(new Populator(this, database, counter, startSignal, endSignal));
                }

                try
                {
                    using (Transaction transaction = database.BeginTx())
                    {
                        database.Schema().indexFor(Label.label("label10")).on("property").create();
                        transaction.Success();
                    }
                    startSignal.Signal();

                    using (Transaction transaction = database.BeginTx())
                    {
                        database.Schema().awaitIndexesOnline(populatorCount, TimeUnit.MINUTES);
                        transaction.Success();
                    }
                }
                finally
                {
                    endSignal.set(true);
                    executor.shutdown();
                    // Basically we don't care to await their completion because they've done their job
                }
            }
            finally
            {
                database.Shutdown();
                ConsistencyCheckService consistencyCheckService = new ConsistencyCheckService();
                Config config = Config.defaults(GraphDatabaseSettings.pagecache_memory, "8m");
                consistencyCheckService.RunFullConsistencyCheck(_testDirectory.databaseLayout(), config, ProgressMonitorFactory.NONE, FormattedLogProvider.toOutputStream(System.out), false);
            }
        }